British Prime Minister Theresa May is no longer in control of events. The Brexit withdrawal agreement she’s currently defending in Parliament has, with reason, been savaged by all sides and seems likely to be rejected in the vote planned for next week. Already, thoughts are turning to Plan B.

The best course is evident: a second referendum, one that would let Britain choose more wisely now that the costs of Brexit are better understood. But the path back to sanity is by no means straightforward, and one obstacle in particular needs to be removed. The European Union should make clear that the decision to quit the E.U. can be reversed.

A “people’s vote” to reverse the Brexit decision looks increasingly possible — but it requires three main things.

First, the U.K. government must either advocate it or let it happen. May and her perpetually divided Cabinet may be unable to reverse themselves on this, as she has repeatedly said there will be no second vote. Thankfully, this might not matter. In one of several humiliating defeats the prime minister suffered this week, the House of Commons asserted the right to vote on alternative proposals if MPs vote down her plan.

Second, the E.U. needs to remove several procedural obstacles. In particular, its leaders need to say that if Britain revokes its Article 50 notification of withdrawal — as it would have to, to give time for a second referendum — the E.U. will not object. Up to now, the European Commission and Council have argued before the European Court of Justice that the revocation would require the unanimous assent of the other E.U. members. This week, the advocate general of the ECJ said this was not so, though the guidance is not binding on the court. Regardless of the ECJ’s ruling, Europe’s leaders should affirm that they’ll let Britain revoke its notice to quit.

Third, the E.U.’s leaders should resist the understandable temptation to drive another hard bargain, this time over getting Brexit reversed. They should say that Europe wants the U.K. to remain, and that it can do so following a second referendum on the same terms as before — with no obligation to join the single currency, with its other opt-outs preserved, and with no change to the prevailing financial terms.

If Brexit can be reversed, which is looking more possible by the day, both Britain and the E.U. gain.