By the time of the second siege, the military situation had turned against the Jacobites; their main force had been badly defeated at the Battle of Aughrim in July, with over 4,000 killed, including their commander, the Marquis de St Ruth, and thousands more either taken prisoner or deserted. The town of Galway capitulated in July 1691; its Jacobite garrison was accorded 'all the honours of war,' which allowed them to retain their weapons and receive a free pass to Limerick. However, although its defences had been considerably strengthened since 1690, morale was now much lower after a series of defeats and retreats. By now, siege warfare was an exact art, the rules of which were so well understood wagering on their outcome and duration had become a popular craze; the then enormous sum of £200,000 was alleged to have been bet on the siege. The Williamite general Godert de Ginkell surrounded the city and bombarded it, tearing a breach in the walls of English town. A surprise Williamite attack drove the Irish defenders from the earthworks defending Thomond bridge, sending its Irish defenders reeling back towards Limerick. The French defenders of the main gate of the city refused to open it for the fleeing Irish and about 800 of them were cut down or drowned in the river Shannon.
Capitulation and treaty
After this point, Patrick Sarsfield ousted the Chevalier de Tessé and the Marquis d'Usson, the French commanders in Limerick, and began negotiations to surrender. He and Ginkel concluded a treaty that promised to: respect the civilian population of Limerick; tolerate the Catholic religion in Ireland; guarantee against the confiscation of Catholic-owned land; and allow Sarsfield and the fully armed Jacobite army to withdraw to France. Limerick capitulated under these favourable terms in October 1691. Sarsfield left Ireland with 10,000 soldiers and 4,000 women and children to enter the French service. This journey has become known as the Flight of the Wild Geese. The terms of the Treaty of Limerick were not honoured by the 1697 Protestant dominated Irish Parliament and Catholics were subjected to the continuous oppression of the Penal Laws which discriminated against them right up to the early 19th century.