Labour Party candidate Michael D Higgins has been elected to succeed Mary McAleese and serve as the ninth president of Ireland.

Mr Higgins said he would be a president for all the people and do his utmost to rebuild public trust in the institutions of the State after he was formally declared president-elect at Dublin Castle after securing more than one million votes following the fourth and final count today.

He said his mandate was "for an inclusive citizenship which is about equality, participation and respect in a creative society, creative and excellent in everything we Irish do; making an Irishness to be proud of in a real republic".

Mr Higgins’s victory was confirmed at Dublin Castle this afternoon following a count which lasted for more than 24 hours. Taoiseach Enda Kenny, Tánaiste Eamon Gilmore and Mr Higgins’s wife, Sabina, and his children were on hand to congratulate the president elect, who will be inaugurated on November 11th.

After the fourth count, Mr Higgins - with 1,007,1004 votes - was confirmed as the winner, finishing almost 400,000 votes ahead of his closest rival, the independent candidate Sean Gallagher.

Sinn Féin’s Martin McGuinness finished third in the poll, ahead of Fine Gael’s Gay Mitchell, and the independents David Norris, Dana Rosemary Scallon and Mary Davis. Five of the seven candidates were on hand for the announcement of the result, with Mr Mitchell and Ms Davis absent.

Mr Gallagher, who was leading opinion polls at the beginning of this week, extended his best wishes to Mr Higgins and said he had no doubt he would be an “outstanding president”.

In his acceptance speech, Mr Higgins said he had been given a clear mandate by the Irish electorate for a presidency based on a very clear set of ideas that he intended to implement with his heart and his head.

"I am particularly grateful to the more than million people who said that I am acceptable to them as the ninth President of Ireland,” he said. "Always in my mind too, will be those who have gone away - and I will be their president too."

Mr Higgins said he would work to reconnect society, economic and ethics as it was a project that Ireland could not afford to postpone.

He said the presidency was an independent office and he had ceased his membership of the Labour Party and stepped down as the party’s president.

Mr Higgins also paid tribute to the six other candidates for bringing forward ideas and said he planned to incorporate some of them in his presidency.

Mr Kenny congratulated Mr Higgins, his family and party on their victory and said he believed Mr Higgins would be “an outstanding president for the country and the people”.

He said the “authenticity of the result” spoke for itself and the public clearly wanted Mr Higgins to be their president.

Mr Kenny paid tribute to the six other candidates for their courage in contesting the election and said Mr Mitchell was “a good man” who worked in a hard and dedicated manner for his party and the principles he believed in.

Mr Gilmore said democracy thrived on choice and the outcome of the election clearly reflected a statement that the public wished to make. He acknowledged Mr Higgins was departing the Labour Party and said it was proud to have had him as a member.

In his speech, Mr Higgins thanked the Labour Party for its nomination; to the independent Oireachtas members who lent their support; and human rights, arts and advocacy groups and those who assisted in his campaign as well as his family.

“I am particularly grateful to the more than one million people who have said that I am acceptable to them as the ninth president of Ireland.

“I will be a president for all the people and from this moment I will cease to be a member and president of the Labour Party, a party which has informed my thinking. . . . The presidency is an independent office, and the Irish people, which I appreciate so much and take with such responsibility, have given a very clear mandate on a very clear set of ideas, to me as the ninth president.”

“I want to be a president too for those who didn’t vote . . . I will encourage and work to recover, and always in my mind too will be those who have gone away and I will be their president too."

Mr Higgins said he had seen and felt the pain of the Irish people over the course of his 14 month campaign.“I recognise the need for a reflection on those values and assumptions often carelessly taken that have brought us to such a sorry path in social and economic terms, for which such a high price has been paid and is being paid.

“I recognise the righteous anger but I also saw the need for healing and the need to move past recrimination,” he said.

“I love our shared island, our shared Ireland and its core decency. I love it for its imagination and its celebration of the endless possibilities for our people, . . . As we leave behind a narrow individualism that values a person for what was assumed to be their accumulative wealth but neglected the connection between the person, the social, the community and the nation.

“That is what we all leave behind now, for which a million people have given me a mandate. Now we must respond collectively and co-operatively to what we all must recognise are our shared problems, be it unemployment, mortgage distress or any form of exclusion.

“We must now work to our strengths at home and abroad, not only co-operatively and collectively but sustainably for the benefit for the benefit for all of our present generations and those to come,” Mr Higgins said.

He congratulated “those great people” who worked in communities throughout the country: “Everywhere good people have commenced a journey towards Irishness of which we can be proud.”

“This necessary transformation which has now begun will I hope result in making the values of equality, respect, participation in an active citizenship the characteristic of the next seven years. The reconnection of society and ethics is a project we cannot postpone,” Mr Higgins added.

Mr Higgins's win was confirmed on the fourth count after Mr Mitchell and Mr McGuinness were eliminated at the end of the third count at lunchtime. Mr Mitchell and Mr McGuinness were excluded together as the total of their votes was lower than the next highest candidate, Seán Gallagher.

The count resumed at 9am today after adjourning once the second count was completed at 1.30am.