When Leo Varadkar called a snap general election for 8 February, he had a comforting scenario in mind. With a Brexit deal finally in the bag after Boris Johnson’s victory in December, the Taoiseach would brandish his credentials as a statesman who had steered the country through some choppy geopolitical waters. Varadkar’s centre-right Fine Gael party was polling an average of 29 per cent last year; a good election campaign might push that into the thirties, well above their 2016 vote share, and an excellent showing after nearly a decade in government.

Both Varadkar and his Fianna Fáil counterpart, Micheál Martin, wanted to end the de facto grand coalition between their parties, and revive the old pattern that had seen Fine Gael and Fianna Fáil alternate in power since 1932 with backing from such smaller groups as Labour and the Greens. Support for the two centre-right parties had fallen precipitously, from 69 per cent in 2007 to less than 50 per cent in 2016. This was meant to be the election in which they bounced back. Instead, their combined vote share slumped to an all-time low and they were overtaken by Sinn Féin, which got 24.5 per cent of first preference votes, to Fianna Fáil’s 22.2 per cent and Fine Gael’s 20.9 per cent.

Nobody expected this outcome, least of all Sinn Féin. The party leadership thought they’d struggle to hold onto some of the seats they won in 2016. Last year’s local and European elections saw Sinn Féin lose two of its three MEPs and nearly half of its councillors. Because of its defensive strategy, which seemed prudent when the election was called, the party won’t have a seat share that matches its vote: the Irish electoral system has multi-seat constituencies, and in many places Sinn Féin could have taken a second seat if it had run more than one candidate. They won’t make that mistake again.

This is unambiguously a turn to the left by Irish voters. Some journalists who should know better represent Sinn Féin as the Irish counterpart of the Rassemblement National in France or Germany’s AfD. In fact, the party has a better record of defending immigrants against racism than its rivals (the actual far right in Ireland refers to Sinn Féin as ‘globalist traitors’). The party’s TD for Sligo-Leitrim, Martin Kenny, was the target of death threats and an arson attack after he spoke in defence of asylum seekers last year; he topped the poll on Saturday.

Sinn Féin’s success owes a lot to pent-up anger among younger voters about the state of post-recession Ireland. Feel-good articles in the international media hailing the Irish recovery don’t capture the mood on the ground. Some of the recent economic growth is fictitious, the product of Ireland’s status as a tax haven; even when the growth is real, it tends to be concentrated in high-tech, high-wage sectors that bypass the majority of Irish workers. Public services haven’t recovered from years of gouging austerity, and a recharged property boom has made home ownership unattainable for many. One of Varadkar’s most telling mishaps on the campaign trail came when he proudly recalled buying his first home at the age of 24.

The Sinn Féin surge manifested itself in the first polls of the campaign and held up until election day. The broadcasters had to scramble to catch up: the first leaders’ debate, in late January, pitted Varadkar against Martin; but the Sinn Féin leader, Mary Lou McDonald, joined them on stage for the final debate on 4 February, changing the whole dynamic. Instead of sparring against one another with subtly different pitches (low taxes v. investment in public services; a strong economy v. ‘an Ireland for all’), Varadkar and Martin had to form a bloc against McDonald, reinforcing the image of them as two wings of the same bird.

In the last week of the campaign, the conservative parties and their media allies stressed Sinn Féin’s historic ties with the IRA and accused it of planning to scrap the juryless Special Criminal Court (which tries terrorism and serious organised crime cases). None of the attacks seemed to resonate, however, with those who were contemplating a vote for Sinn Féin. McDonald’s predecessor, Gerry Adams, had enough personal baggage to fill a cargo hold, but the party is now led by a younger, postwar generation. That Sinn Féin had served in government with its Unionist opponents in Belfast for more than a decade made it harder to credit the predictions of doom if the party were to exercise power in Dublin.

The next few weeks will test all the conventions of government formation in Ireland. If the conservative parties refuse to deal with their emboldened rival – and Varadkar has explicitly ruled it out – they could join forces again, allowing Sinn Féin to lead the opposition. But they would only be setting themselves up for a heavier defeat next time. If they won’t work together, and no one is able to form a government, there will have to be a repeat election in a few months’ time. And that, too, is likely to strengthen Sinn Féin, especially if it runs more candidates.

For its part, Sinn Féin will have to be very careful in making its next move. The Irish Labour Party made a comparable breakthrough in 2011 but slumped to its worst ever performance five years later after a coalition deal with the centre right. If Sinn Féin doesn’t satisfy the desire for change that powered its electoral triumph, it may lose its new supporters as quickly as it gained them.