lost control of several cities, including Junar and Nashik, and retreated to Konkan. Bijapur had two political factions. The first, which Shahaji sided with, favoured resisting Mughal influence in Deccan. The second favoured establishing peace with the Mughals by recognizing their control over parts of the former Ahmadnagar territory. In 1636, the second faction emerged more powerful, and a peace treaty was signed between Bijapur and the Mughal Empire. As part of this treaty, Bijapur agreed to help the Mughals subjugate Shahaji, or depute him away from the Mughal frontier if he chose to serve Bijapur. The Mughals besieged the Mahuli fort where Shahaji and Murtaza, the pretender to the Ahmadnagar throne, were residing. In October 1636, Shahaji surrendered Mahuli and Junnar to the Mughals and returned to the Bijapur service. As a result, the Mughals controlled a major part of present-day Maharashtra, including Pune and Indapur. In Bangalore Shahaji was allowed to retain his jagir in the Pune region but was barred from living in the area as part of the Mughal-Bijapur treaty. The jagir was placed under the nominal administration of his son Shivaji, with his subordinate Dadoji Kondadev as its manager. Shahaji was transferred to the southern part of the Bijapur Sultanate. Shahaji spent the last 20 years of his life in the south, where the Bijapur and the Golconda Sultanates were trying to capture territories from the declining Vijayanagara Empire. Having established peace with the Mughals in the north, the Bijapur government directed its military to the southern frontier. An army led by the general Rustam-i-Zaman Ranadulla Khan invaded Mysore with Shahaji serving as a subordinate commander. During each campaigning season between 1637–1640, Bijapur forces crossed the Krishna and the Tungabhadra rivers, and entered Mysore. The Bijapuri forces defeated several Nayakas, local chiefs who administered the area after the decline of the Vijayanagara. In December 1638, the Bijapur forces seized Bangalore, which was assigned to Shahaji. Shahaji was also given charge of the Kolar, Hoskote, Doddaballapura, and Sira areas by Ranadulla Khan, in consultation with the Bijapur ruler Muhammad Adil Shah. Shahaji chose Bangalore as his headquarters because of its secure fortress and good climate. While Shahaji was unable to retain control of this entire territory after the departure of the main Bijapur army, the Bijapur army's annual expeditions continued to bring more territories under his control. The Bijapuri exercised little control over the Bangalore region,