the war turned against the royalist factions, and on 23 april 1644 parliamentary forces commenced the siege of york. a scottish army under alexander leslie came from the south, while a parliamentary force under ferdinando fairfax came from the east. six weeks later, edward montagu brought a third contingent to york, bringing the number of forces besieging the city to over 30,000 men. william cavendish commanded the city during the siege, while colonel sir francis cobb was appointed the governor of the castle. despite bombardment, attempts to undermine the walls and attacks on the gates, the city held out through may and june. prince rupert, sent to relieve york, approached with reinforcements, and through clever manoeuvring was able to force the besiegers to withdraw, lifting the siege on 1 july. the next day, parliamentary forces defeated rupert at the battle of marston moor, six miles west of york, making the surrender of york and the castle inevitable. on 14 july the city and castle surrendered to the parliamentary forces, who permitted the royalists to march out with full honours.