Irish presidential election: Michael D Higgins elected
The Labour Party's Michael D Higgins has been officially confirmed as the ninth Irish president after one of the most remarkable comebacks in the state's history.
The poet and campaigner received 701,101 first-preference votes - almost 40% of the total.
His victory over one-time favourite Sean Gallagher was evident within an hour of the ballot boxes being opened.
A welcome home ceremony will be held in his native Galway on Sunday.
It will take place at an open air event in Eyre Square at around 16:30 GMT.
Mr Higgins was elected on the fourth count with 1,007,104 votes.
Mr Gallagher received 628,114 votes.
Mr Higgins hosted a reception at the Mansion House in Dublin on Saturday night for members of his campaign team and paid tribute to them for the huge effort they had made during the election.
In his acceptance speech, Mr Higgins said he wanted to be a president for all the people.
He said Irish people had to work together to tackle their shared problems.
"We must now work to our strengths at home and abroad, not only cooperatively and collectively but sustainably for the benefit of all of our present generations and those to come," he said.
"The necessary transformation of which I speak and of which my presidency will be a part is built on turning creative possibilities into living realities for all our people."
He also announced that from "this moment" he would cease to be a member and president of the Irish Labour party.
"The presidency is an independent office and the Irish people whom I appreciate so much and I take with such responsibility have given a very clear mandate on a very clear set of ideas to me, as the ninth president," he said.
Speaking on Friday night, Mr Higgins said his seven-year term would be marked by inclusion, ideas and transformation.
"I'm very, very happy. It is something I prepared for, something I thought about for a long while," he said.
"I am very glad as well that it is a presidency built on a campaign that emphasised ideas. I hope it will be a presidency that will enable everybody to be part of and proud of."
Mr Higgins will be inaugurated on Armistice Day, 11 November, the day after current president Mary McAleese leaves office.
At the end of the third count on Saturday, Sinn Fein's Martin McGuinness and Gay Mitchell of Fine Gael, were both excluded. Mr McGuinness had 265,196 votes and Mr Mitchell was on 136,309.
The quota Mr Higgins had to reach was 885,882 votes.
Mr Gallagher received 504,964 first-preference votes, while Mr McGuinness, Sinn Fein, came in third with 243,030 votes.
Independents Dana Rosemary Scallon and Mary Davis were eliminated on the first count. Dana Rosemary Scallon received 51,220 votes and Mary Davis 48,657 votes.
On the second count independent David Norris was excluded. He received 113,321 votes which were then redistributed.
Mr Higgins seized an unprecedented swing in support earlier this week after his biggest rival, independent candidate Mr Gallagher, was publicly derailed by Sinn Fein's Martin McGuinness on live television.
Mr Gallagher, the opinion poll topper with a 15-point margin as recently as Sunday, saw his support vanish to 28% in a stunning defeat blamed on his links to Fianna Fail, the party most associated with Ireland's economic demise.
Mr Higgins was an Irish MP for almost 25 years until he retired from the Dail earlier this year. He was Ireland's minister for arts, culture and the Gaeltacht during the 1990s.
The president, who serves as a ceremonial head of state, is elected for a seven-year term and can be re-elected only once.
Mr Gallagher, a former member and fund-raiser for the Fianna Fail party, called the veteran politician to congratulate him on his success.
In a statement, Mr Gallagher said: "He will have my full support as president and I sincerely thank him for a positive campaign.
"His slogan stated that he would be a president to be proud of and I believe he will be that president."
Mr McGuinness also phoned Mr Higgins to offer his congratulations.
"He will make a fine president and I wish him well for his seven years in the Aras (presidential home)," he said.
"I am delighted with the strong vote I have received. My message of positive leadership, patriotism and commitment clearly was resonating with tens of thousands of ordinary Irish people."
Other candidates in the election have also congratulated Mr Higgins.
Fine Gael's Gay Mitchell said he would make "an excellent president," while Dana Rosemary Scallon wished him a "happy and successful" time in office.
Tanaiste (Deputy Prime Minister), Eamon Gilmore, congratulated his party colleague on his victory.
Mr Gilmore admitted it had looked like Mr Gallagher was poised for victory, until a televised debate on RTE earlier this week.
Mr Gallagher was forced to deny claims by Mr McGuinness that he had raised money for the Fianna Fail party when it was in government in 2008.
"That certainly made a big impact, but I think it was Sean Gallagher's response to the questions he was asked," added Mr Gilmore.
"I think there was a cumulative effect, which saw Sean Gallagher's vote dropping and going to Michael D Higgins."
The Irish opposition leader Micheal Martin of Fianna Fail also sent his congratulations to Mr Higgins.
"I have known Michael D Higgins for many years and he will make an excellent president and ambassador for Ireland," he said.
Fianna Fail chose not to enter a candidate following the party's heavy defeat in the general election.