BELFAST (Reuters) - A nationalist surge at elections in Northern Ireland and a Scottish demand for a second independence referendum have raised doubts over whether the United Kingdom can hold together after it leaves the European Union.

Sinn Fein President Gerry Adams and Sinn Fein leader Michelle O'Neill speak to media outside Stormont Castle in Belfast, Northern Ireland. REUTERS/Clodagh Kilcoyne

Last year’s referendum on EU membership saw England and Wales vote to leave while Scotland and Northern Ireland voted to remain, straining the ties that bind the UK together.

Scottish leader Nicola Sturgeon dealt a blow to British Prime Minister Theresa May on Monday by demanding a new vote on independence in late 2018 or early 2019, making her move much sooner than expected.

But while the Scottish issue had been well flagged since the Brexit vote, a snap provincial assembly election in Northern Ireland produced a genuine shock: for the first time since the partition of Ireland in 1921, unionists lost their majority.

Nationalist party Sinn Fein, backed by many of Northern Ireland’s Catholics, narrowed the gap with the Democratic Unionist Party, whose support base is among pro-British Protestants, to just one seat.

This has revived the slow-burning question of whether Northern Ireland will stay in the United Kingdom over the long term or become part of the Republic of Ireland. This could be achieved by a referendum, often referred to as a border poll.

“A border poll might be 10 years away and it might still be lost, but clearly this election has shown a different dynamic in Northern Ireland politics,” said Peter Shirlow, Director of Irish Studies at the University of Liverpool.

“This opens the door for a different scenario.”

Nationalist leader Gerry Adams, who is 68 and still hopes to see a united Ireland in his lifetime, told Reuters Sinn Fein had sensed new interest in Irish unity from voters.

But May, whose party is officially called Conservative and Unionist, has stated a deep personal commitment to keeping the 300-year-old UK together and is determined not to go down in history as the prime minister who allowed it to fall apart.

Opinion polls in the past have shown only limited support for Irish unity, including among Catholics. That is partly because of high awareness of the province’s dependence on public sector jobs, welfare benefits and other flows of UK cash.

“BREXIT CHANGES EVERYTHING”

Senia Paseta, a professor of modern Irish history at the University of Oxford, said the economic context was a key part of the picture south of the border as well.

Slideshow ( 4 images )

“I don’t think reunification is likely in the short to medium term, not least because the Irish Republic is rightly wary of taking on Northern Ireland,” she said.

But while Irish unity may not be on the cards anytime soon, the balance of opinion could change over time under the combined impact of Brexit and of demographic shifts that could favor Irish nationalism.

In Belfast’s mainly Catholic Ardoyne area, a frequent flashpoint of communal tensions, no one was getting carried away just yet.

“I really hope what happened will make a border poll more likely, the sooner the better. But there are more of them than us still, so it would need some Protestants to vote for unity,” said resident Sean Doherty.

Northern Ireland’s population of 1.8 million is still majority Protestant, although demographic trends point to Catholics becoming the majority within a generation -- as they are in the Republic, which has a population of 4.8 million.

The northern province suffered three decades of sectarian violence, known as the Troubles, which cost 3,600 lives until the Good Friday peace agreement was signed in 1998.

Since then, Northern Ireland had mostly faded into the background of British politics, until the collapse in January of a provincial government that shared power between the DUP and Sinn Fein. Sinn Fein used to be the political wing of the Irish Republican Army, though it has long been committed to constitutional politics and the IRA has laid down its arms.

Renewed momentum towards a united Ireland and an independent Scotland is the last thing May needs as she begins the mammoth task of negotiating the terms of the UK’s exit from the EU and of its future trading relationship with the bloc.

Brexit is particularly disruptive for Northern Ireland because its border with the Republic is the UK’s only land border with the EU, raising the prospect of tougher border controls when the UK leaves the European single market.

“On this issue, as on so many others, Brexit changes everything,” wrote political columnist Noel Whelan in the Irish Times last week.

“Northern nationalists have cause now to fear being marooned economically and politically behind a hard border and living in a polity where greater sovereignty over their lives is restored to British institutions.”

“IT WILL NEVER HAPPEN”

May has said she wants the border to remain open, but has given no details as to how this can be achieved post-Brexit.

“No border, hard of soft, will be accepted by the people of Ireland. What British armored cars and tanks and guns couldn’t do in Ireland, 27 member states will not be able to do,” said Martina Anderson, a Sinn Fein member of the European Parliament, speaking in the chamber this week.

But on the other side of Northern Ireland’s political divide, opposition to Irish unity remains strong.

“A united Ireland, no way, it will never happen,” said Trevor Herron, a pensioner in Belfast’s staunchly unionist Woodvale Road area.

“They don’t have the same benefits system down south. You have to pay to go to the doctor, pay for prescriptions. The politicians can play politics as much as they want but when it comes to money, economics, they (Catholics in Northern Ireland) know they are better off up here.”

Oxford University’s Paseta has argued that there was little appetite for unity south of the border because the status quo offered the Republic peaceful co-existence with the North and some involvement in its affairs while the British Treasury provided economic support.

Nevertheless, the issue of Irish unity has been slowly inching its way into policymakers’ minds in Dublin.

Irish Prime Minister Enda Kenny has called for the Brexit treaty, when it happens, to specify that Northern Ireland would join the EU immediately if it united with Ireland.

Opposition party Fianna Fail, the favorite to win the next Irish elections, is preparing a plan on how a united Ireland would work in practice.

As well as the disruptive effect of Brexit itself, a huge uncertainty hanging over Northern Ireland is what will unfold in Scotland and what impact it will have on the province.

Scotland voted against independence by 55 to 45 percent in a 2014 referendum, but that was before the Brexit referendum.

Sturgeon and her Scottish National Party have argued that Scotland should not be dragged out of the EU against its will, and hence should have the option of a new independence vote.

A Scottish exit would be a huge psychological blow to Northern Ireland’s unionists, many of whom are descended from 17th century Scottish settlers and feel strongly about their historic ties to Scotland and the wider UK.

Sinn Fein’s Adams said nationalists had to win over unionists to the idea of a unified Ireland and give them confidence they would have a prosperous future within it. He did not expect this to happen overnight.