Soon after leaving the university he settled on the paternal estate and began to take a part in the public political meetings in Dublin. At the general election in 1826 he became a candidate for the representation of that city, but after a severe and expensive contest lasting fourteen days was defeated by a small majority. In 1830 and 1832 he again unsuccessfully contested the seat for Dublin. At the close of another election for Dublin in January 1835 the numbers were: O'Connell 2,678, Ruthven 2,630, Hamilton 2,461, West 2,455. A petition was, however, presented; the commissioners sat from 3 May 1835 to 6 January 1836, and from 29 Feb to 26 May, when Hamilton and West were declared duly elected. In the following year, 1837, he again contested Dublin unsuccessfully, and although in presenting a petition he was supported by ‘the Protestants of England,’ and a sum of money known as the Spottiswoode subscription was raised to assist him in paying his expenses, O'Connell on this occasion retained his seat. Throughout his career he took the side of the Orangemen, and was a prominent figure in the Protestant demonstrations. On the formation of the ‘Lay Association for the Protection of Church Property’ in August 1834, he became the honorary secretary of the association, and for a long period worked energetically in the cause. In parliament he was chiefly known as having presented the petition of the celebrated Protestant meeting of 14 January 1837, which gave rise to much discussion and subsequently to the Earl of Roden's committee of inquiry. On 10 February 1843, on the occurrence of a chance vacancy, he was returned by the University of Dublin, which constituency he represented without intermission until February 1859. To him was mainly due the formation of the Conservative Society for Ireland, which formed the rallying point for the conservative party after the passing of the Reform Bill. On 2 June 1845 he spoke on the subject of the 'godless college bill', as the measure which became the Queen's Colleges Act 1845 was popularly known, due to the fact that the three colleges it created could not give instruction in theology. Another speech of 21 August 1848 was printed with the title of 'Education in Ireland. Report of Speech in the House of Commons on Mr. Hamilton's motion on above subject,' 1848. On 21 June 1849 his proposal for an alteration in education in Ireland so as to make it acceptable to the Protestant clergy was lost by 162 to 102 votes. He held the financial secretaryship of the treasury under Lord Derby's administration from March to December 1852, and again on the return of the conservatives to power from March 1858 to January 1859. At this latter date he was appointed Permanent Secretary of the Treasury. He was sworn a member of the Privy Council of the United Kingdom 7 August 1869, and in the following year was named one of the Commissioners of the Church Temporalities in Ireland. He was a magistrate and Deputy-Lieutenant for Dublin County, and an LL.D. of Dublin University.
Private life
In his role as local landowner and MP he was, like his father and grandfather, very active in the commercial development of Balbriggan, expanding the harbour facilities and encouraging the development of the local hosiery manufactory. He was chairman of the company that built the Great Northern Railway from Dublin to Belfast. A keen antiquarian, he conducted rescue archaeology on a major passage grave discovered at Gormanston, County Meath, in the course of the building of the railway and wrote reports on this and other archaeological discoveries in the proceedings of the Royal Dublin Society. During the Great Irish famine he chaired the Relief Committee in the Balrothery Union of parishes which provided soup, bread and meal to the starving throughout the North Fingal area.
Death
He died in Kingstown, Ireland, 17 September 1871 and was buried in St George's church, Balbriggan. Despite his lifelong advocacy of unionism the last few miles of the journey to his burial was lined by thousands of grieving Roman Catholics and he received a laudatory obituary in the Nationalist Freeman's Journal.
Family
His wife, whom he married 1 May 1835, was Amelia Fancourt, daughter of Joshua Uhthoff of Bath, Somerset, England. His father-in-law had a distinguished career in the Colonial Civil Service, and became Deputy British Resident at Poona.