Randaula Khan then invaded Mysore, whose ruler Kanthirava Narasaraja I negotiated peace by paying 500,000 rupees to Bijapur. Subsequently, Kenge Nayaka rebelled against Bijapur, and asserted independence at Basavapattana, where he raised an army of 70,000 soldiers to guard the fort. Randaula Khan then formed an alliance with his former overlord Virabhadra, the former Nayaka of Ikkeri, and besieged Basavapattana. Afzal Khan, along with Shahaji and some commanders of African origin, was deployed at the main gate of the Basavapattana fort. He entered the fort after a fierce battle, killed the guards, and captured the "qasba" - the central part of the fortified town. Kenge Nayaka then launched three successive attacks against him, but Afzal Khan forced him to retreat. Encouraged by Afzal Khan's successes, the Bijapur forces attacked Kenge Nayaka's contingent from both sides. After losing 3,700 soldiers, Kenge Nayaka surrendered the fort, and agreed to pay Bijapur 4 million "huns". He was imprisoned, and later killed for attempting to bribe a guard for his release.