He was first elected to Parliament in 1790. He was appointed Foreign Secretary in 1801 and helped to negotiate the Peace of Amiens with France in the following year. He was Home Secretary during 1804–06 and declined the premiership on the death of William Pitt. He became Secretary for War and the Colonies in 1809, reluctantly taking office as Prime Minister (1812–27) after the assassination of Spencer Perceval. After the Napoleonic Wars his government used repressive measures to deal with popular discontent (Peterloo massacre), opposing both parliamentary reform and Catholic emancipation. Towards the end of his tenure the more liberal influences of men like Sir Robert Peel and William Huskisson (1770–1830) led him to support the introduction of some important reforms.