Arlene Foster, leader of the Democratic Unionist Party, speaks to members of the media outside Stormont Parliament Buildings in Belfast on March 6. (Clodagh Kilcoyne/Reuters)

LONDON — British Prime Minister Theresa May thought she would sweep elections with a broad mandate to run the exit negotiations with the European Union, but it did not work out that way.

Now it appears that a little party in Northern Ireland needs to come to the Tory’s rescue.

May’s Conservative Party is forecast to win 319 seats in Thursday’s snap election, seven short of the 326 needed for a majority in parliament. That certainly wasn’t her plan.

And so May has spent the dawn hours at 10 Downing Street ringing her counterparts at the Democratic Unionist Party in Northern Ireland, which won 10 seats.

On the surface, the Irish unionists have much in common with the Tories. They’re traditionalists — God save the queen and the Union Jack. They are also more socially conservative than the Tories. They’ve vetoed same-sex marriage proposals and opposed access to abortion services. Their critics say the unionists are supported by paramilitary groups. And they really dislike Labour leader Jeremy Corbyn.

The Tories say May has struck a deal — what they are calling “an understanding” — with the Democratic Unionist Party.

A DUP source told the Guardian newspaper, “We want there to be a government. We have worked well with May. The alternative is intolerable. For as long as Corbyn leads Labour, we will ensure there’s a Tory PM.”

But this support comes at a price.

Northern Ireland as a whole voted strongly in favor of remaining in the European Union in the vote last June, by a majority of 56 percent to 44 percent. Unionist leaders urged their constituents to vote Leave, but the ballots among their own supporters were divided.

In the aftermath of the vote to leave the European bloc, DUP politicos have pushed for a kinder, gentler Brexit, and one that takes into account the unique history and geography of Ireland.

Remember that Northern Ireland is part of the United Kingdom — along with England, Wales and Scotland — and shares a long porous border with E.U. member Ireland to the south.

That border was a kind of no man’s land, populated by British soldiers, gunmen and smugglers during the decades of battles against the Irish Republican Army.

As The Washington Post reported last year, more than 180 formal roads cross that border — many more if you count tractor trails and foot paths. Most of the time, a traveler barely sees a sign noting the change in countries. This will now become Europe’s back door to Britain and vice versa.

It was only 15 years ago that the last bomb exploded in the long conflict between British security forces and Ulster loyalist paramilitary groups and the Irish Republican Army. More than 3,500 people were killed during the Troubles, half of them civilians.

Nobody wants to see its return, but there are fears on both sides that Brexit could awake old demons — and usher in a “hard border,” with customs checkpoints and immigration controls.

Arlene Foster, leader of the DUP, has warned both against a hard border and a hard Brexit. In the party’s 2017 election manifesto, a top promise was: “Work to get the best Brexit deal for Northern Ireland.” It appears they are now in a good position to push for that.