Layard now turned to politics. Elected as a Liberal member for Aylesbury, Buckinghamshire in 1852, he was for a few weeks Under-Secretary for Foreign Affairs, but afterwards freely criticised the government, especially in connection with army administration. He was present in the Crimea during the war, and was a member of the committee appointed to inquire into the conduct of the expedition. In 1855 he refused from Lord Palmerston an office not connected with foreign affairs, was elected lord rector of Aberdeen University, and on 15 June moved a resolution in the House of Commons (defeated by a 359–46 majority) declaring that in public appointments merit had been sacrificed to private influence and an adherence to routine. After being defeated at Aylesbury in 1857, he visited India to investigate the causes of the Indian Mutiny. He unsuccessfully contested York in 1859, but was elected for Southwark in 1860, and from 1861 to 1866 was Under-Secretary for Foreign Affairs in the successive administrations of Lord Palmerston and Lord John Russell. After the Liberals returned to office in 1868 under William Ewart Gladstone, Layard was made First Commissioner of Works and sworn of the Privy Council.