During the ensuing Siege of York, the Royalist garrison defended the city vigorously, and Glemham was credited with destroying a Parliamentarian mine under Walmgate Bar, by digging a counter-mine through which the attackers' mine was flooded. On 1 July the city was relieved by a Royalist army under Prince Rupert of the Rhine. Late the following day, the forces Rupert and Newcastle were decisively defeated at the Battle of Marston Moor. Newcastle went into exile in Hamburg, while Rupert returned south with the survivors of his army. Glemham was left with only 1500 men to defend York. He nevertheless held out until 16 July and obtained favourable terms from the besiegers. No Scottish troops were to enter the city, and such of the garrison as wished to continue to fight were allowed to march out with all the honours of war and were given safe passage to Skipton, where some men marched south to join the King's main forces while Glemham with some 200 "reformadoes" (officers from regiments which had been destroyed or disbanded) went to Carlisle. Glemham was appointed Commander-in-Chief of the four northernmost counties of England, but effectively controlled only Carlisle itself. From October 1644 to June 1645, Carlisle was closely besieged by Scots under Major General Sir David Leslie. Glemham again maintained an active defence, repeatedly raiding the besiegers' lines. He finally capitulated when all supplies had been eaten and the garrison and townsfolk faced starvation. Leslie again granted favourable terms, allowing all the honours of war and escorting the garrison to Hereford where they might join the King. Glemham was created D.C.L. at Oxford on 22 April 1645. In October 1645, he was appointed Governor of Oxford, the King's wartime capital. He made extensive preparations to withstand a lengthy siege although by this time, the King had very few forces left to him. In April 1646, the Parliamentarian Commander-in-Chief, Sir Thomas Fairfax, began the final Siege of Oxford. The King left Oxford in disguise. Glemham maintained a defence despite pressure from some of the King's Privy Councillors who were trapped in Oxford to surrender. Both negotiations for a surrender and a furious bombardment of the siege lines were continuing when a letter was received from King Charles, now a prisoner of the Scots, commanding Glemham to cease resistance. The garrison of 3,000 marched out with all honours of war and disbanded.