Becoming a Whig in politics, he entered government in 1806 as part of the Ministry of All the Talents as Master-General of the Ordnance, which enabled him to carry a philanthropic measure, which he had promoted since his first entry into the House of Lords, the Debtor and Creditor Bill for relief of poor debtors. However, he resigned his post on the fall of the ministry the next year. He was also Constable of the Tower (of London) from 1806 to his death. Being a close associate of the Prince-Regent, Moira was asked by him to form a Whig government after the assassination of Spencer Perceval in 1812 ended that ministry. Both of Moira's attempts to create a governing coalition failed, but as a mark of the prince's respect he was appointed to the Order of the Garter in that year. The Tories returned to power under the Earl of Liverpool. On 6 December 1816, after the conclusion of the Anglo-Nepalese War (see below), Moira was raised to the rank of Marquess of Hastings together with the subsidiary titles Viscount Loudoun and Earl of Rawdon.