DUBLIN/CORK, Ireland (Reuters) - Irish nationalists Sinn Fein demanded on Sunday to be part of the next Irish government after the left-wing party secured the most votes in an election that leader Mary Lou McDonald described as a ballot-box “revolution”.

The former political wing of the Irish Republican Army, which has recast itself as the main left-wing party, secured 24.5% of first-preference votes, almost doubling its share from the last election in 2016.

That put it ahead of the center-right Fianna Fail on 22.2% and the Fine Gael party of Prime Minister Leo Varadkar at 20.9% in an election analysts described as a seismic shift away from Ireland’s century-old, center-right duopoly.

“I think it is fair to say that this election has been historic. It is something of a revolution in the ballot box,” McDonald told reporters after arriving at her election count to a huge ovation from party supporters.

But her party appeared set to fall behind at least one of its rivals in terms of seat numbers after the surge caught even it off guard and it stood far fewer candidates. It is unlikely to be more than a junior partner in government as a result.

The final results will not be known until Monday or later. It took the parties 10 weeks to form a government in 2016.

Sinn Fein’s ultimate goal is reuniting British-run Northern Ireland with Ireland and has said a condition for any coalition is the immediate preparations for a unity referendum it would push London to hold within five years.

She said Sinn Fein would talk to all parties about forming a government and that others should accept their responsibility to do the same.

“I do not accept the exclusion or talk of excluding our party, a party that represents now a quarter of the electorate, and I think that is fundamentally undemocratic,” she said.

Fine Gael and Fianna Fail, which have between them led every government since the 1922 foundation of the state, ruled out a coalition with Sinn Fein before the election.

But although Varadkar reiterated his rejection because of “principle and policy”, Fianna Fail leader Micheal Martin declined to repeat earlier refusals to consider a coalition with Sinn Fein, saying only that there were significant incompatibilities on policy.

“Our policies and our principles have not changed overnight,” he said. “But what is important is that the country comes first.”

Some of his senior lawmakers disagreed strongly, however, with the idea of such a coalition.

Slideshow ( 18 images )

IRA WAR

Sinn Fein has moved on from the long leadership of Gerry Adams, the face of the IRA’s war against British rule in Northern Ireland - a conflict in which some 3,600 people were killed before a 1998 peace deal.

Irish tricolor flags were flown at a Dublin count center as Sinn Fein supporters were led in a chorus of the Irish rebel song “Come Out Ye Black and Tans” by a lawmaker jailed for possession of explosives in 1981.

Slideshow ( 18 images )

Opponents of Sinn Fein say its high-spending promises and pledge to increase taxes on the wealthy would discourage foreign multinationals that employ one-in-10 Irish workers.

But some parties have praised detailed policies such as a proposed rent freeze and the large-scale building of houses by the state to tackle the cost and availability of housing, the key election issue.

Varadkar’s Fine Gael, in power since 2011, were not certain to have more seats than Sinn Fein, the 41-year-old premier said.

Martin predicted Fianna Fail would emerge on top.

Fine Gael’s focus on the fastest-growing economy in the European Union and success in negotiating a Brexit deal that avoided a “hard border” with Northern Ireland - with border checks reinstated - failed to capture the imagination of voters more focused on issues such as health and housing.

Varadkar said he would talk to all parties except Sinn Fein about forming a government. The option of another minority government led by either Fine Gael or Fianna Fail or a first coalition between the two parties also remains.

“It’s not going to be easy to put a government together, for anyone,” said Foreign Minister Simon Coveney of Fine Gael.