The only land border between the United Kingdom and the rest of the European Union winds for 500 kilometers through the green fields and gentle hills of the Irish countryside. The border has a tragic past, a tranquil present—and the potential to shape the future of Brexit.

During the conflicts between Republicans and Unionists, its 200 crossing points saw countless clashes and frequent deaths. Since the 1998 Good Friday Agreement, the border has been completely open. If you drive from Northern Ireland into the Irish Republic, the only obvious indications that you have entered another country are that kilometers replace miles on road signs, and post boxes are green instead of red. The unrestricted flow of trade and people is one of the great benefits of two decades of peace. Nobody wants to return to the era of border posts, far less the paraphernalia of passport checks and customs buildings.

The question is: How can an open border survive Brexit?

The EU’s answer is that Northern Ireland must remain part of the EU customs union, and abide by all the EU’s current and future business regulations. Otherwise, border posts will have be revived.

The UK rejects this view, for it would leave Britain with two choices, both of which are unacceptable.

Option 1: The whole of the UK remains in the customs union and continues to abide by many, if not all, single market rules. This would deny the UK the right to conclude new trade deals with the rest of the world; and it would require UK businesses to obey EU regulations, which the UK will no longer have any say in crafting. In the vivid language of Jacob Rees-Mogg, one of the keenest pro-Brexit MPs, Britain would become a “vassal state.”

Option 2: Mainland Britain leaves the customs union and single market completely, but accepts a different status for Northern Ireland, which would remain within the EU’s orbit, applying customs union and single market rules. This would require trade barriers between Northern Ireland and the rest of the UK. Theresa May, Britain’s Prime Minister has ruled this out—not least because anything that loosened the bonds that bind the UK together would be anathema to Northern Ireland’s Democratic Unionist Party, whose support she needs to remain in power in Westminster.

British ministers say modern technology can square the circle, allowing trade across the border to be regulated by smart electronics rather than customs officers at crossing points. The EU rejects this as a pipedream.

Twice this issue has come close to derailing the Brexit negotiations—last December (ahead of the agreement to embark on the negotiations about transition) and last month (when the transition agreement was concluded). Both times a fudged form of words was agreed. There would be no hard border, but no agreement was reached on what this meant.

The danger for the UK is that the EU will reject a third fudged agreement and insist that the price of an open-border deal will be for either Northern Ireland or the whole of the UK to remain within the customs union (or something that looks very much like it).

What then? At Westminster, a drama is underway that might yet grow into a crisis. Already, twenty-four Conservative peers have voted with the opposition to defeat ministers in the House of Lords by demanding a commitment for the UK to maintain a customs union relationship with the EU.

Defeat in the Lords is not fatal to the government. Peers are not democratically elected. Except in very rare circumstances, disputes between the two Houses of Parliament end up with unelected peers giving way to elected MPs.

However, rebel Conservative MPs in the House of Commons have tabled amendments to two Brexit-related bills to maintain a customs union relationship with the EU after Brexit. These votes are likely in the next few weeks. They are likely to be very close. There is a real prospect of government defeats.

How bad would that be for Mrs. May? Terrible, if she decides to stake her premiership on the votes. But she has an alternative. She could regard defeats in the Commons as a blessing in disguise. Keeping the UK in a customs union with the EU would go some way to keeping the Irish border open. It could lead to a Brexit agreement that the EU Council, and the British and European Parliaments, are willing to accept—even if many pro-Brexit Conservative MPs dislike it.

This course, however, is not without peril. A wider agreement will be needed if the Irish border is to remain fully open. The UK will need to accept at least some of the single market rules, both on business regulations and on freedom of movement. A customs union deal alone would take UK-EU relations only halfway across the road from an economically damaging hard Brexit to a soft, open-border Brexit. And we all know that stopping halfway across a busy road is seldom a good idea.

If the UK does complete that crossing, ardent Brexiteers will complain that the essence of Brexit has been lost, for the UK will not have full control over its own affairs. In the opposite corner, pro-EU enthusiasts will argue that Brexit had become pointless and that the UK should remain in the EU with a voice in its decisions. The one thing on which both sides will agree is that such an outcome is far from perfect. But as things stand now, a perfect Brexit of any sort looks beyond reach.