It was an it-will-never-ever-happen moment when, in May 2007, Ian Paisley and Martin McGuinness together took power in Northern Ireland’s devolved government. Optimism reigned, and I said I would be the “last direct-rule secretary of state”. But after 10 years of stable and peaceful devolution that prediction could be undone.

Obduracy over a green energy financial scandal from the Democratic Unionist party’s first minister, Arlene Foster, precipitated first a collapse of the power-sharing executive into an election, and then a seismic result in which – for the first time – unionists do not have a majority in the local legislature.

The DUP has lost its power of veto, and enabled Sinn Féin to ride high just one seat behind them. The nationalist SDLP has been squeezed, and the once mighty Ulster Unionists perhaps irreversibly sidelined. Apart from Sinn Féin only the liberal Alliance party surged, seemingly beneficiaries of disillusioned unionist votes.

Nobody has a clue what will now unfold. Is there hope that two charismatic woman leaders, Sinn Féin’s Michelle O’Neill and Alliance’s Naomi Long, can broker common ground with the DUP’s Foster to rescue devolved government – assuming that they all will be meaningfully included in negotiations?

It is striking how male dominance of Northern Ireland’s harsh politics has been vanquished. But Foster’s inept handling of the energy debacle, and her approval for a pettily bigoted withdrawal of a £50,000 grant to support Irish language teaching, caused huge resentment in the nationalist and republican communities. It does not bode well, especially since her position has been weakened by the election setback. She needs to show some humility and a new consensual leadership in the face of Sinn Féin’s buoyancy. Equally this will be a big moment for the so far untested O’Neill, with her deeply rooted republican pedigree. Will she, like Martin McGuinness, prove capable of real leadership, rather than follow too narrow a republican agenda?

As for Sinn Féin’s now powerful position, it could harden, or the party could reciprocate if, and it’s a big “if”, the DUP demonstrates magnanimity after such a setback. But the DUP, Ian Paisley’s year of “Chuckle Brothers” rule with Martin McGuinness apart, has never been big on magnanimity. Meanwhile, the issue of how to deal with Northern Ireland’s troubled, tangled past, remains toxic. Long retired British soldiers face prosecution, provoking outrage among both their families and unionists who perceive what they see as an unjustified focus on the state’s role in the conflict. What about prosecutions of former IRA assassins, is their question.

Both magnanimity and mutual respect are needed, otherwise Northern Ireland will get completely bogged down in its gruesome past, instead of properly supporting victims and building a new future.

What the British government now does is key. And here the signs are not encouraging either. Theresa May’s government, like David Cameron’s, has abandoned the non-partisan stance that delivered peace and power-sharing under Tony Blair and Gordon Brown. Since 2010, the Tories, currying favour for DUP votes, have hardly concealed their favouritism. I am not sure they really understand the politics of the island of Ireland, even in the way that John Major had started to do. After Cameron’s ill-fated coalition with the Ulster Unionists in the 2010 election and cosy dinners at No 10 with DUP MPs, the current Northern Ireland secretary, James Brokenshire, has also been criticised for pro-unionist bias, and not just by republicans.

To help secure the settlement of 2007, when I was secretary of state for Northern Ireland under a Labour government I formed as close a relationship with Ian Paisley as with Gerry Adams, and their deputies, Peter Robinson and Martin McGuinness – just as my predecessor, Paul Murphy, had done.

If a combination of short-sighted London ministers and intransigent local politicians allows Northern Ireland to slip back into direct rule, the precedent is ominous. It took five years – from 2002 to 2007 – before we were able finally to devolve power. Who knows how long again if, as many are despairingly predicting, direct rule is repeated?

To compound the crisis, Brexit hovers, and again the British government has offered no answers over the future of the 300-mile Irish border that will become the customs frontier of the European Union. And the harder the Brexit, the harder the border. Yet nationalist, and above all republican, buy-in to the peace process has been cemented by an open border, since it normalises relations between both parts of the island. For them it is iconic, and for unionists, either doing business or going about their daily lives, it is also extremely valuable.

These past few years both London and Dublin have taken their eyes off the ball. May, with the Irish prime minister, should now intervene and convene an urgent summit to bring all the parties together to thrash out an agreement. Otherwise she will likely be adding Northern Ireland direct rule woes to her Brexit burdens.