So the nightmare has actually happened. With the decision of the UK to leave the European Union, Ireland now faces a series of consequences - and hard choices - in the short, medium and long term.

Firstly, it is clear that Britain and Europe both face a period of economic and political turmoil, and that Ireland will be deeply affected by this. It is hard to see how the ultimate effects will be anything other than overwhelmingly negative.

Of course, Border controls will not go up immediately. Trade won’t stop overnight. But this morning’s reactions in the markets are a harbinger of things to come. Some difficult changes are on the way.

For Enda Kenny’s administration, however long it remains, the rest of its term of office will be dominated by the fallout from this morning’s result. In a few hours, everything has pivoted, everything has changed.

The electoral drubbing that Enda Kenny suffered and the long period of Government formation meant that his second coalition never really experienced anything like a honeymoon period. But there was at least a period of relative calm in recent weeks, which promised to last until the end of the summer. That period ended in the small hours of this morning.

Mr Kenny now faces leading Ireland through a period of difficulty and uncertainty unprecedented in the last 50 years, more complex and unpredictable than the recent financial crisis, more destabilising the Northern Troubles.

Aside from the immediate political and economic effects - which are likely to be considerable and adverse - it will necessitate the remaking of Ireland’s place in the world, as relations between our two biggest trading and political partners are sundered in a manner as yet unknowable. Of all the things that could happen to an Irish government short of the outbreak of war, this is pretty much up there with the worst of them.

The European Union now faces a crisis of its legitimacy, and its member states a crisis of their democracies, as the rise of populist movements of the political extremes is boosted, perhaps towards power. There is also likely to be a period of deep economic recession. The history of Europe tells us that these things are not good bedfellows.

The breakup of the UK now seems closer than ever before, perhaps inevitable whenever the formal break with the EU comes. It is hard to see pro-EU Scotland sticking with anti-EU England. This break will prompt the most profound questions for Northern Ireland since its establishment as a separate political entity from the rest of Ireland.

Central to the Northern Ireland peace settlement was a slow but inexorable process of making the border less important. Now it is about to get more important. That may not immediately threaten the peace process, but it certainly requires a resetting of the tri-partite relationships between Ireland, Britain and the North.

This will be a delicate process, to say the least of it, undertaken at a time when the two governments are dealing with multifaceted other challenges.

Some measure of preparation for today’s outcome has been going on in Dublin for some time. Ever since David Cameron announced that he would hold a referendum back in 2012, Irish officials and latterly ministers have regarded the prospect of a British exit from the EU as the worst thing that could happen the country.

Podcast: Brexit Special

That view is contested by some Independents and the radical left parties but it is shared, to a greater or lesser degree, by Fine Gael, Fianna Fáil, Labour, Sinn Féin and many of the Independents.

A range of negative effects have been identified, and measures proposed to mitigate or counteract them. But senior officials say that it is difficult to plan for a Brexit until it becomes clear what sort of Brexit Britain intends to effect.

Will the UK leave as soon as possible, or have a period of disengagement that lasts for several years, as some British officials advise? Will they seek to retain membership of the single market? If not, what rules will govern trade between Ireland the Britain - including the South and the North of this island? What will be the nature and legal basis of British-Irish relations, from free movement to tax treaties?

These questions have now attained an urgent importance for Ireland. However, it is likely that the present Cameron administration will not be around for much longer to decide them.

The leadership of the British government is soon likely to pass to people who - as a Financial Times editorial yesterday described them - “are not credible future leaders of the UK”.

The tentative progress towards a giveaway budget in October is likely to be one of the first victims of the result. Earlier this week, Minister for Finance Michael Noonan and Minister for Public Expenditure Paschal Donohoe delivered their Summer Economic Statement, in which they outlined their optimistic (though by no means unrealistic) expectation of having probably in excess of a billion euros to give away in the October budget in tax cuts and extra spending. They have only just recently allocated another half a billion euros in spending this year, principally for health.

But the same document also warned that the economic effects of a British exit would probably wipe out the “fiscal space” - the proceeds of economic growth from which any tax cuts or spending increases are paid.

Should the expected post-Brexit UK recession take hold, the real impact in Ireland would be to derive the Irish Government of hundreds of millions of euros - and possibly into the billions - of revenue. Any increase in unemployment would start pushing social welfare bills higher. Prudence would probably demand a cautious budget. In other words, the prospect for giveaways would recede, and possibly quickly.

If the recession was severe, before long we would be back to austerity budgets. It is doubtful that the present government could withstand any sustained period of austerity. This will be high on the agenda of the Irish Government when ministers meet in emergency session this morning.

By the end of the summer, they will have to decide if the Brexit recession is sufficiently deep to cancel budget giveaways, planned public sector pay increases, and capital spending plans.

Before that, the Government will mandate all arms of the state to push out a strong message internationally that Ireland will not follow the UK out of the EU. Embassies, politicians, agencies like the IDA - all of them will be pressed into service to reassure investors, stock markets and foreign governments.

Within the EU, sources say that the Irish Government will insist that the Britain is not marginalised, or “punished”, in the negotiations on the mechanics of exit. When David Cameron was negotiating his new relationship with the EU - ultimately rejected by his voters - Enda Kenny was his closest ally. That is likely to continue at next week’s emergency European summit.

In the medium term, however, Ireland will not just seek to influence negotiations between the EU and the UK - we will have to redefine our own relationship with our nearest neighbour. The social, cultural and civic relationships between the two islands have never been closer.

But the economic and political relationships have now been thrown into doubt. The most visible aspect of this will be the status of the border, but that is only one aspect of it. There’s a billion euros a week in Anglo-Irish trade.

But Ireland will also seek to take advantage of the UK’s exit. There will be - indeed, there has already been - gentle overtures to financial institutions in the City of London that 50 minutes away on an airplane there is an English speaking EU member, with equally strong links to the US, a strong legal system and a business-friendly government where they would be very welcome to bring their highly paid jobs and their tax contributions. That process will intensify in the coming weeks.

In the longer term, the British exit will present the most serious challenge to the EU in its existence. Some analysts believe that Brexit will push the core of the EU closer together, towards a political union to complement economic and monetary union. Some integrationists in France and Germany actually welcomed the prospect. It looks more like wishful thinking than clear-headed analysis.

The most powerful forces are moving in the opposite direction; anti-EU movements in France, in Italy, in Germany, in Holland, in the Nordic countries, in Austria and elsewhere are likely to draw inspiration from the success of the British campaign. This is not just about the EU; it is about immigration, globalisation and the increasing alienation of people from the political class.

The UK has had a complex about Europe for a long time; it is part of who they are. But disaffection with the EU institutions and suspicion of its leadership is evident right across Europe. After today’s result, few Governments could be guaranteed of carrying a strong majority in favour of continued EU membership. If this is not a crisis for the EU, then what is?

It was evident from the campaign that the gulf between many ordinary British people and their political leaders and institutions is immense. During the campaign, polling suggested that almost half of all leave voters expected that the result would be fixed by the remain-dominated establishment.

This suggests that a huge chunk of the British population believes they are being governed without their consent: think about that for a minute.

Similar currents of public opinion exist here; they explain much of the recent general election result - a rejection by many voters of established politics, a reaction against elites, a surge for populist politics. It is present in a far uglier form all over Europe.

This morning’s result suggests that this angry alienation is becoming the defining political spirit of the age. Ironically, Britain is irrevocably part of this European movement. This morning, as the dust settles, the British result seems like the beginning of something rather than the end. There may be trouble ahead.