O'Hanlon entered his first electoral contest when he was the Fianna Fáil candidate in the 1973 Monaghan by-election caused by the election of Erskine Childers to the Presidency. He was unsuccessful on this occasion but was eventually elected at the 1977 general election for the Cavan–Monaghan constituency. O'Hanlon was one of a handful of new Fianna Fáil deputies who were elected in that landslide victory for the party and, as a new TD, he remained on the backbenches. Two years later he became a member of Monaghan County Council, serving on that authority until 1987. In 1979 Jack Lynch suddenly resigned as Taoiseach and leader of Fianna Fáil. The subsequent leadership election resulted in a straight contest between Charles Haughey and George Colley. The latter had the backing of the majority of the existing cabinet, however, a backbench revolt saw Haughey become Taoiseach. O'Hanlon had supported Colley and was thus overlooked for appointment to the new ministerial and junior ministerial positions. In spite of this he did become a member of the powerful Public Accounts Committee in the Oireachtas. When Fianna Fáil returned to power after a short-lived Fine Gael-Labour Party government in 1982, O'Hanlon was once again overlooked for ministerial promotion. An extensive cabinet reshuffle towards the end of the year saw O'Hanlon become Minister of State for Social Welfare Payments. His tenure was short-lived as the government fell a few weeks later and Fianna Fáil were out of power.
Government minister
In early 1983, Charles Haughey announced a new front bench and O'Hanlon was promoted to the position of spokesperson on Health and Social Welfare. Following the 1987 general election, Fianna Fáil were back in power, albeit with a minority government, and O'Hanlon became Minister for Health. Immediately after taking office, he was confronted with a number of controversial issues, including the resolution of a radiographers' dispute and the formation of an HIV/AIDSawareness campaign. While Fianna Fáil campaigned on a platform of not introducing any public spending cuts, the party committed a complete u-turn once in government. The savage cuts in relation to healthcare earned O'Hanlon the nickname "Dr. Death". In spite of earning this reputation, O'Hanlon also introduced law to curb smoking in public places. O'Hanlon's handling of the Department of Health meant that he was one of the names tipped for promotion as a result of Ray MacSharry departure as Minister for Finance. In the end, he was retained as Minister for Health and was disappointed not to be given a new portfolio following the 1989 general election. In 1991, O'Hanlon became Minister for the Environment following Albert Reynolds' failed leadership challenge against Charles Haughey. When Reynolds eventually came to power in 1992, O'Hanlon was one of several high-profile members of the cabinet who lost their ministerial positions.
Post-cabinet career
In 1995, O'Hanlon became chairman of the Fianna Fáil parliamentary party before being elected Leas-Cheann Comhairle of Dáil Éireann in 1997. Following the 2002 general election, O'Hanlon became Ceann Comhairle of Dáil Éireann. In this position, he was required to remain neutral and, as such, he was no longer classed as a representative of any political party. He was an active chairman of the Dáil; however, on occasion, he was criticised, most notably by Labour's Pat Rabbitte, for allegedly stifling debate and being overly protective of the government. Following the 2007 general election, he was succeeded as Ceann Comhairle by John O'Donoghue. He was the Vice-Chairman of the Joint Oireachtas Committee on Foreign Affairs. He retired from politics at the 2011 general election.
Personal life
Two of O'Hanlon's children have served as local politicians in Cavan–Monaghan, a son Shane is a former member of Monaghan County Council and a daughter Fiona O'Hea served one term on Cootehill Town Council while the Sinn Féin TD Caoimhghín Ó Caoláin, is also a relation of O'Hanlon. O'Hanlon is also the father of the well-known actor and comedian Ardal O'Hanlon.