Dundas was appointed
Keeper of the Signet for Scotland and elected MP for
Midlothian (Edinburghshire) in 1801. He remained silent in parliament until his speeches of 1805 and 1806 in defence of his father, who was then being impeached. His first real test came in negotiating to be left in charge of Scotland by a hostile 'ministry of all the talents'. He got nowhere, but won the respect of his own side, and the problem vanished with the ministry's collapse. He was rewarded with the presidency of the
Board of Control for
India by the
Duke of Portland in 1807. Dundas's main task was to frustrate any possibility that
Napoleon might exploit his alliance with
Russia to make some attempt on British India. He sent a mission to the shah of
Persia, at whose court French agents were present. He formed alliances with the princes of
Lahore and
Kabul. He ordered the occupation of the Portuguese factories in India and
China, of the Dutch colony of Java, and of the French stations on
Mauritius and
Réunion. He had also to deal with a sharp deterioration, through loss of trade during the war, in the finances of the
East India Company. A series of reports on its development since the
East India Company Act 1784 (
24 Geo. 3. Sess. 2. c. 25), written by a select committee which he chaired, concluded that it should give up its inefficient trading privileges, at least in the subcontinent. Dundas drafted the legislation which ended them at the renewal of the company's charter in 1813. Dundas's Indian administration was interrupted for six months in 1809 when he served as
Chief Secretary for Ireland.
Spencer Perceval, succeeding Portland, then wanted to promote him to the cabinet as secretary for war, but this did not happen due to the wishes of his father. Dundas returned to the Board of Control, still without a place in cabinet. He succeeded as
Viscount Melville on 27 May 1811. Two months later, he was appointed
Keeper of the Privy Seal of Scotland in place of his father. The next year, under Prime Minister
Lord Liverpool, he was promoted
First Lord of the Admiralty. ==Admiralty==