In 1332 the Earl of Dunbar was appointed by the assembly of the estates (Parliament) at Perth, joint Guardian of the Crown, upon the death of the Regent, Thomas Randolph, 1st Earl of Moray. He opposed Edward Balliol in several battles and skirmishes following the Battle of Dupplin Moor. In January 1333 he was appointed Governor of Berwick Castle but was forced to surrender it following the Battle of Halidon Hill in July 1333. The Earl of Dunbar and several others of the nobility paid fealty to King Edward. The Earl attended Edward Balliol at the parliament held at Edinburgh in February 1334 when they ceded to England Berwick, Dunbar, Roxburgh, and Edinburgh, as well as all the southern counties of Scotland. Earl Patrick had had his castle levelled to the ground, but Edward III of England now compelled him to rebuild the fortress at his own expense and garrisoned it with English troops. Dunbar castle was not restored to the Earl until 1338.