After the castle of Buda was wrested from Ottoman rule in 1686, the armies went to capture the rest of Pécs. The advance guards could break into the city and pillaged it. The Ottomans saw that they could not hold the city, and burnt it, and withdrew into the castle. The army led by Louis of Baden occupied the city on 14 October and destroyed the aqueduct leading to the castle. The Ottomans had no other choice but to surrender, which they did on 22 October (see Siege of Pécs).