In 1529, the Ottomans captured Pécs again, and went on a campaign against Vienna. The Ottomans forced Pécs to accept King John (who was allied with them) as their ruler. John died in 1540. In 1541, the Ottomans occupied the castle of Buda, and ordered Isabella, the widow of John to give Pécs to them, since the city was of strategic importance. The citizens of Pécs defended the city against the Ottomans, and swore loyalty to Ferdinand. The emperor helped the city and defended it from further Ottoman attacks, but his advisers persuaded him into focusing more on the cities of Székesfehérvár and Esztergom instead of Pécs. Pécs was preparing for the siege, but a day before, Flemish and Walloon mercenaries fled from the city, and raided the nearby lands. The next day in June 1543 the Bishop himself went to the Ottomans with the keys of the city.