Irish poet Michael D. Higgins will become the country's next president after results on Friday showed the 70-year-old had beaten a reality-TV star and a former IRA commander in elections.
Veteran Labour politician Higgins vowed to be a "president for all the people" after he takes over from Mary McAleese in the post, which is largely ceremonial but still symbolically important amid Ireland's economic woes.
Independent candidate and businessman Sean Gallagher, in second place, conceded victory, as did third-placed Martin McGuinness of Sinn Fein, the former paramilitary who is now deputy first minister of Northern Ireland.
"I am very glad that it is so decisive," Higgins, a former arts minister, told reporters as the initial results came through. "It will enable me to be a president for all the people."
Higgins had 39.6 percent of the first preference votes under Ireland's complicated electoral system.
Gallagher, a shaven-headed entrepreneur who won fame from the reality TV show "Dragons Den", was on 28.5 percent and McGuinness on 13.7 percent. There were four other candidates.
"I've called Michael D. Higgins to congratulate him on his performance and his success in this election," Gallagher said in a statement ahead of the release of the results.
"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," Gallagher added.
The outcome represents a remarkable turnaround for Higgins, who was trailing far behind Gallagher in opinion polls going into the final week of campaigning.
But Gallagher saw his lead melt away after McGuinness accused him of collecting a 5,000-euro ($7,000) donation from a convicted criminal in a stormy live televised debate on Monday.
Gallagher bitterly denied having handled it and accused McGuinness of launching a "political assassination" attempt, but the damage was done.
The implication was that Gallagher was more deeply involved than he said with Fianna Fail, his former party which lost heavily in February's general election as it took the blame for Ireland's economic crisis.
McGuinness also sent his congratulations to Higgins, who will get the keys to the Aras an Uachtarain, the president's smart official residence in Dublin's Phoenix Park.
"He will make a fine president and I wish him well for his seven years in the Aras," McGuinness said, adding that he was delighted with his own share of the vote, having topped the poll in the Donegal North-East constituency.
"My message of positive leadership, patriotism and commitment clearly was resonating with tens of thousands of ordinary Irish people," he said.
Sinn Fein president Gerry Adams said McGuinness's vote share had narrowed the gap beween politics in the south and Northern Ireland, where they have a greater foothold.
Deputy Prime Minister Eamon Gilmore, the Labour leader, said Higgins had attracted "much greater" support than the party ever got.
"That is a great tribute to him, all the work he has done down the years," he said.
He said he was surprised by Gallagher's poll lead, "because the response we were getting in campaigning was much stronger for Michael D. Higgins."
The president is responsible for representing the country, receiving foreign heads of state and making visits abroad to promote Irish interests and strengthen links with the large global diaspora.
As the ninth president, Higgins will succeed Belfast-born McAleese, who has served the maximum two seven-year terms as the figurehead of the republic which required an 85 billion euro ($120 billion) international bailout last year.
He is a veteran intellectual who has written two volumes of poetry, fluent in Irish, and first entered parliament in 1973.
Independent Senator David Norris, the first openly gay presidential candidate, was likely to finish fifth.
Turnout was at 56 percent. More than 3.1 million people were eligible to vote.
The single transferable vote system was used, whereby voters rank candidates in order of preference. Candidates are eliminated in turn and their votes redistributed until one has an absolute majority.
Final results were expected early Saturday.