Fianna Fáil may still be the largest party in the next Dáil, be in a position to lead a government and elect Micheál Martin as taoiseach, but it did not expect to find itself at this pass.
The party has slipped in vote share and could lose seats. Martin’s project of rehabilitating the party after its role in the economic crash of a decade ago has stalled, and the confidence and supply agreement has backfired in electoral terms.
One of Fianna Fáil's most prominent TDs – Lisa Chambers, the Brexit spokeswoman – is on course to lose her Mayo seat. The party still has huge problems in Dublin.
Fianna Fáil had a lacklustre but not necessarily bad campaign. It seemed Martin had decided that a steady-as-she-goes approach was best and would convince voters that Fianna Fáil could bring about change, but change middle Ireland could trust.
Yet the structural cause of Fianna Fáil’s difficulties at this election go back to the last, and the decision to enter into the confidence and supply agreement which saw it underpin the Fine Gael-led minority government for four years.
The deal was Martin's creation, having turned down an offer from Enda Kenny to enter into a so-called grand coalition between the two civil war parties. It allowed for stable government, and was also a vehicle to allow Martin to show middle Ireland his party could be trusted again.
Originally intended to last for only three years, Martin extended the deal to take in a fourth budget due to Brexit uncertainty.
The extension, Fianna Fáil also thought, would provide extra time for the public to tire of Leo Varadkar. In mid-2018, Varadkar was riding high in opinion polls after the passage of the referendum to repeal the Eighth Amendment.
The political calculation that the shine would come off Varadkar was correct. What was perhaps less expected was that confidence and supply would be used to such effect against Fianna Fáil by its opponents, principally Sinn Féin.
Mary Lou McDonald repeatedly tied Fine Gael and Fianna Fáil to each other on issues like housing and health, an attack which was hugely successful in neutralising Martin's claim to be the agent of change in the election.
Those who voted for change and for Sinn Féin were, according to canvassers, voting not just against Fine Gael but against Fianna Fáil too.
Since he took over the wreckage of Fianna Fáil in February 2011, Martin has shown patience with a parliamentary party that at times seemed to delight in opposing him and causing trouble.
Recent years have seen Martin impose greater discipline on his party but the outcome of this election weakens his position internally.
As he entered his own count centre in Cork South Central, he opened the door to entering government with either Sinn Féin or Fine Gael – two outcomes he said he would not entertain during the campaign.
His statement allowed some TDs to publicly say what many have said privately: that coalition with Sinn Féin should not be ruled out.
Other TDs, such as Michael McGrath and Jim O'Callaghan, said they were opposed to such a government.
The debate is only starting within Fianna Fáil about what it should do. McGrath said Sinn Féin’s economic policies are not compatible with those of Fianna Fáil, but he did not rule out coalition with Fine Gael.
Other TDs say another governing arrangement between Fianna Fáil and Fine Gael is not the radical change the county asked for.
Martin will have to steer this delicate debate over the coming days and weeks. It will be made more difficult by the fact that many TDs are likely to be unhappy with the party’s election performance.
There was already some grumbling from senior Fianna Fáil TDs that their appearances during the election campaign had been limited.
The Fianna Fáil campaign was more or less the Micheál Martin and Michael McGrath show, with other frontbench spokespeople making cameo appearances over the past 3½ weeks.
The election postmortem in Fianna Fáil will likely focus on whether confidence and supply hampered its performance in this election, and TDs may feel free to criticise the approach of the party leader.
Whatever course Martin chooses – coalition with Sinn Féin or coalition with Fine Gael – he may meet more resistance from within his ranks than he did when he entered into confidence and supply four years ago.
Martin is still odds on to lead the next government, but he may have to take an unexpected route to the taoiseach’s office.