By Carmel Crimmins and Padraic Halpin

DUBLIN (Reuters) - Ireland's presidential election on Thursday pitched a former guerrilla commander against a television reality show star and a politician turned poet.

Martin McGuinness, once a leading figure in the Irish Republican Army's (IRA) fight against British rule in Northern Ireland, was unlikely to win but by running he gave a fillip to his Sinn Fein party and its campaign for a united Ireland.

Analysts said the race was too close to call between independent candidate Sean Gallagher, a businessman who shot to fame through reality television, and poet and former culture minister Michael D. Higgins, who is a member of the coalition government's junior Labour Party partner.

But McGuinness's controversial candidacy shook up an initially dull race, prompting some government ministers to paint him as a villain and splitting opinion among voters.

"What they (IRA) did in the past was extremely bad but they have moved away from that. A win for McGuinness would cement those changes... We have to move on," Tom O'Connor, a 57-year-old psychotherapist, said after voting for McGuinness in central Dublin. "I think Sinn Fein have moved away from the margins. I hope if McGuinness loses, Sinn Fein will work to change the past and become more representative, more inclusive."

Once the political wing of the now-defunct IRA, Sinn Fein has always campaigned for a united Ireland but so far has only been able to make major political inroads in Northern Ireland.

Buoyed by public anger over the country's economic crisis that led to an EU/IMF bailout late last year, Sinn Fein tripled its seats to a record 14 in the Irish Republic's 166-seat lower parliament in a February election.

The only major party in the Irish Republic to oppose the EU/IMF-imposed austerity drive, Sinn Fein has capitalized on McGuinness's candidacy and became the second most popular party for the first time in a recent opinion poll.

This was a far cry from when Sinn Fein members were officially banned from speaking on Irish media until 1993. Even until recently they were viewed as political pariahs because of the three decades of guerrilla warfare in Northern Ireland.

"Sinn Fein's objective in putting (McGuinness) into the race was primarily to advance progress in the Republic and by participating vigorously they will have raised the morale of the organization," said political analyst Noel Whelan.

"They will have improved the party's position somewhat and polls suggest maybe even by three or four percentage points, but not as dramatically as they would have hoped, given McGuinness's celebrity and not without drawing criticism or focus on the IRA's legacy."

"GLAD IT'S OVER"

A hero among Catholics in Northern Ireland for helping to end the decades of sectarian bloodshed, McGuinness's insistence that he left the IRA in 1974 has elicited disbelief and strong criticism south of the border.

He was confronted on the campaign trail by the son of an IRA victim and some sought to punish Sinn Fein for temporarily parachuting the street fighter-turned-peacemaker south from his role as Northern Ireland's deputy first minister.

"I don't think McGuinness will do well. There's too much bad blood there about the past. I hope Sinn Fein stay a marginal party," said Gary, 30, who declined to give his second name.

"I'm glad it's over. It wasn't an election campaign, it was just mud-slinging for 4 to 5 weeks."

Irish presidential elections are notoriously grubby affairs because of the focus on personality over policy and this race has been no different with the latest round of controversy hitting the chances of front runner Gallagher.

Gallagher looked set for victory on Monday after the race's final opinion poll put him 15 percent ahead of nearest rival Higgins but revelations since over his ties to Fianna Fail, the party thrown out of power earlier this year, prompted local bookmakers to make Higgins the new favorite.

(Writing by Padraic Halpin; Editing by Mark Heinrich)