In January, Sinn Féin, Northern Ireland’s second-largest party, abandoned the government, causing its collapse and triggering a new round of elections. Sinn Féin’s decision was a distinct act of protest, a reaction to a scandal that has ensnared Arlene Foster, the leader of the Democratic Unionist Party (DUP), the country’s largest political party. The new election, which was held on Thursday, was Northern Ireland’s second in just 10 months.

On Friday, as results began to come in, Foster told a journalist from Sky News, “This has been a very good day for Sinn Féin.” Of course, she’s correct. Sinn Féin has gained a good deal of ground, coming within just one assembly seat of the DUP, denying Foster’s party the crucial 30-seat plurality that allows any party to employ a veto mechanism, the same mechanism which the DUP recently used to block same-sex marriage legislation. But the DUP and Sinn Féin are still Northern Ireland’s two largest parties, and the issues that precipitated this snap election in the first place remain unresolved.

Overall turnout on Thursday was almost 65 percent—an increase of almost 10 points from the most recent election last May. Perhaps some of that spike in participation stems from the fact that this is no ordinary election. In many ways, its result will test the resilience of Northern Ireland’s fragile power-sharing system, set up in 1997 by the Good Friday Agreement, which officially ended the almost three decades of sectarian fighting known as the “Troubles.” From 1969 to 1997, unionists and republicans fought, often violently, over the fate of their country. The unionists wanted the North to remain a part of the United Kingdom, while the republicans wanted the North to join the Republic of Ireland. To appease both communities, the Good Friday Agreement established a system in which power would be shared. The two sides—largely represented in this election by the republican Sinn Féin and the unionist DUP (both communities also include numerous other smaller parties)—pledged to govern together, with the republican community accepting the North’s continued status within the U.K., and the unionist community agreeing to share political power with republicans. (In Northern Ireland, republicans are often called nationalists. There are differences between the two, but the terms refer to the same broad community.)

Under the terms of the agreement, Northern Ireland’s executive would be led by a first minister and a deputy first minister, one from a republican party and one from a unionist party. Neither republicans nor unionists could act without the consent of the other. The first minister and deputy first minister positions would also be interdependent: The government could not have a first minister without a deputy first minister, ensuring each community would have a stake in the other’s participation in government. It would never be in either camp’s interest to allow intra-party relations to sour to such an extent that the first or deputy first minister would be forced to resign, because then the entire government would simply collapse.

Brendan O’Leary, who advised the British, Irish, and American governments during the Good Friday negotiations, told me that for most of the past 20 years this system has worked relatively well. “In general, the power-sharing institutions have been a remarkable success,” O’Leary said. “The core institutions functioned, and they presided over what, by comparative standards elsewhere in the world, has been a remarkably successful peace process.” But the events of recent months, starting with the Brexit vote and, now, this election, have revealed how vulnerable the power-sharing system in Northern Ireland has always been.

The scandal that now threatens the Good Friday system began back in 2012, when Northern Ireland’s First Minister Arlene Foster, then minister for enterprise, trade, and investment, helped initiate a subsidy program to encourage people to use renewable fuel to heat their homes. But the absence of price controls led to major cost overruns and claims of deliberate abuse, sticking Northern Irish taxpayers with a bill of almost £500 million for a program that was originally supposed to cost £25 million over five years. The first investigation into the program began in February 2016, after whistleblowers claimed it had overspent by millions.

Then, last December, another whistleblower claimed Foster had not only mismanaged the program, but had refused to address its deficiencies even after learning of them, unwilling to face the political repercussions. Ten days after the news broke, Deputy First Minister Martin McGuinness, the leader of Sinn Féin, called for Foster to temporarily step aside while the scandal was under investigation. She refused, saying she did “not take her instructions from Sinn Féin.” Sinn Féin, in turn, announced it could not work with a DUP with Foster at the helm. The DUP said it had been trying to fix the program since 2015, but accused Sinn Féin of using the allegations against Foster as an excuse to force an election. In January, McGuinness stepped down, reportedly for health reasons, and Sinn Féin chose not to nominate a replacement—its way of officially withdrawing from the government and triggering new elections.

While the scandal was the immediate cause of the election, Northern Ireland’s government was already headed for breakdown. “[T]he big elephant in the room is Brexit, which these two parties [Sinn Féin and the DUP] have taken different positions on,” John McGarry, a professor of political science at Queen’s University in Canada who has worked extensively on power-sharing and policing in Northern Ireland, told me.

Like a majority of the U.K., the DUP supported Brexit, spending hundreds of thousands of pounds on anti-EU ads. And like a majority of Northern Ireland, Sinn Féin wanted the U.K. to remain within the EU. This pit the two parties—which are supposed to lead the country together—against one another in the run-up to the Brexit vote, and even more so in its aftermath.

O’Leary said that Sinn Féin saw the DUP’s decision to back Brexit, which none of the four other main parties supported, and economists warned would be especially bad for Northern Ireland, as reckless. “From Sinn Féin's point of view, not only were the DUP being ideological, they were acting against the evident self-interest, the material self-interest of Northern Ireland,” O’Leary said. “And so if you have a partner that is irresponsible, a partner that won't listen to advice, it's a very difficult issue.”

As Brexit began to shred the fragile threads of trust between Sinn Féin and the DUP, it also further exacerbated underlying tensions between the larger republican and unionist communities. Perhaps the most crucial of these is the land border between Northern Ireland and the Republic of Ireland. Since 1923, the U.K. and Ireland have maintained the Common Travel Area (CTA), which allows free movement of people between the two. But when the U.K. finally leaves the EU, that border will no longer divide two EU member-states, putting its current open status into question. British Prime Minister Theresa May continues to maintain that there will be no return “to a border of the past for Northern Ireland,” but it’s still unclear what that even means.

Republicans and nationalists, as well as moderate unionists and independents, want Northern Ireland to receive a special status allowing it to remain in the EU’s common travel area, thus retaining free movement between the North and the Republic. More hardline unionists, like Foster, reject this solution for precisely the reason the others embrace it: It would mean, as McGarry put it, “Northern Ireland wasn't in the United Kingdom in the same way as everywhere else.”

On Tuesday, during the second half of the final leaders debate, this issue of Brexit and the border dominated discussion. At one point, while the candidates were arguing over the role of the EU and the Republic in negotiating the North’s post-Brexit fate, Colum Eastwood, the leader of the Social Democratic and Labor Party, shouted, “It’s not up to the British government!”

Amid the rancorous debate, this was a particularly telling moment. At the most basic level, Northern Ireland’s political divisions stem from whether the country should be part of the United Kingdom or the Irish Republic. Much of the Good Friday Agreement was concerned with ensuring that both the U.K. and Ireland would have a role in Northern Ireland. So for the North, Brexit is not only an exit from the EU, but one step further away from Ireland. To a nationalist like Eastwood, this is unacceptable. In 1997, the British government agreed to allow the North to have a uniquely close relationship with the Republic. By leaving the EU, the U.K. will be breaking that agreement, upsetting the careful balance of Northern Irish politics.

Although this week’s election has been called “the most important” since the Good Friday Agreement, the actual results look very similar to 10 months ago. The DUP has won 28 seats to Sinn Féin’s 27, forcing them, once again, into government together. But maintaining the status quo isn’t necessarily a good thing, as the disputes between the two parties that led to this snap election remain unsettled.

According to Sinn Féin, the party forced the election because of Foster’s refusal to step aside. Nothing about that situation has changed: Foster remains the head of the DUP, and thus the party’s choice for first minister should it win the most votes, and Sinn Féin still refuses to work with her. During that last debate, Michelle O’Neill, the party’s new leader, made this very clear. “I can’t dictate who leads the DUP, but I can dictate who we [Sinn Féin] go into government with,” she said.

Before the election, some speculated that, should the DUP perform poorly, Foster’s party might pressure her to step down, or at least agree to Sinn Féin’s demand for her to step aside during the investigation of the subsidy program. But now, with the votes counted and DUP’s 10-seat loss clear, it doesn’t appear this will happen. Jeffrey Donaldson, who represents the DUP in Westminster, told the Beflast Telegraph that Foster’s leadership is safe. “Arlene is leading the largest party and we need to get on with the job of forming a government that works for us all,” he said.

If three weeks pass and the DUP and Sinn Féin still can’t come to an agreement that will allow them to form a government together, it’s likely that  London will temporarily impose direct rule on Northern Ireland while the British and Irish governments try to hammer out some sort of deal between the two parties. So at the very moment that Northern Ireland needs its government at the table to help negotiate the details of Brexit, it will be left without one.

In this scenario, although the immediate concern will be a deal between Sinn Féin and the DUP, it is possible that this deadlock, plus the announcement of a border arrangement unpalatable to either the union or republican camp, could seriously threaten stability. At this point, no one is seriously considering a return to the violence and chaos of the Troubles, but uncertainty is making people uneasy. “If it turns out that there's a hard border between the North of Ireland the Irish Republic this would be completely unacceptable to Irish nationalists and would be a profound threat, not just to power-sharing but to the peace process,” McGarry said.

For months, most have assumed that the largest domestic fallout from Brexit would come from the Scots, who are poised to hold another referendum on their independence. But, to understand the kind of damage Brexit could end up causing inside the United Kingdom itself, it may well be time to turn away from Edinburgh and towards Belfast.