When the Vijayanagara Empire was troubled after the Battle of Tallikota in 1565, the Pemmasani Nayaks, Ravella Nayaks and Sayapaneni Nayaks helped the Aravidu Dynasty in keeping the Muslims at bay. It took another 90 years to consolidate the Muslim power in Andhra country with the capture of Gandikota in 1652 and the defeat of Pemmasani Timmanayudu by Mir Jumla. Following the Battle of Talikota, many Kamma Nayaks either migrated to the dominions of the Madurai and Thanjavur Nayaks where they governed villages and supplied military officers or obtained favours from the Qutb Shahis and Mughals and settled in Telugu regions as local military chiefs.