Boris Johnson likes to rail against the “surrender bill” passed by MPs in Westminster to stop him leaving the EU without a deal — but it was he who made a Brexit deal possible largely by surrendering to most EU demands.

Most dramatically, he agreed to put a customs border in the Irish Sea, something that his predecessor, Theresa May, said no U.K. prime minister could ever accept — and a far cry from the "final offer" he unveiled at Tory conference two weeks ago.

But the path to a deal was not all one-way traffic.

To converge on an agreement, the EU did its own bit of backtracking, reversing course on a few key points that have given Johnson more than enough room to tell British MPs that he did not dance alone in front of a mirror during the last frantic weeks of negotiations.

With a few crucial concessions that bent, or even broke, some of Brussels’ hard-line positions, EU chief negotiator Michel Barnier showed that not only was the clock still ticking but the EU could, in fact, be creative and imaginative when it puts its mind to it.

Reopening the Withdrawal Agreement

It became an EU mantra shortly after the U.K. parliament’s first rejection of a Brexit deal: There will be no reopening of the Withdrawal Agreement — only changes to the accompanying, non-binding Political Declaration.

A long list of EU27 leaders joined that chorus: Commission President Jean-Claude Juncker; Council President Donald Tusk; the chief negotiator Barnier; the Irish prime minister, Leo Varadkar, and his deputy, Simon Coveney; French President Emmanuel Macron; and Austrian Chancellor Sebastian Kurz.

Even just two months ago, in late August, German Chancellor Angela Merkel, the leader of EU leaders, insisted on the same point: “We will, of course, think about practical solutions, and I always say that if you want to find these solutions, you can do so in a short period of time,” she told reporters on a visit to Iceland. “The European Union is ready to do this, but we don’t need to open up the Withdrawal Agreement. It’s a question of the future relationship.”

In the end, the EU cracked the Withdrawal Agreement open, and heavily rewrote the protocol on Ireland and Northern Ireland, which all of the stakeholders agree was the single most instrumental step in reaching a deal.

Those revisions, along with additional changes to the Political Declaration on the future relationship, now allow the U.K. prime minister to tell MPs he is presenting them with a divorce decree that is fundamentally different from the one put forward by May that they rejected three times.

Overall, most of the roughly 600-page withdrawal treaty — on crucial issues like citizens’ rights and the financial settlement — remains the same. Still, EU backtracking, while perhaps inevitable given Brussels was facing a new negotiating team with a demand for a new deal, proved crucial.

Customs

EU officials and diplomats have long insisted the bloc's single market must be protected with strong external border checks on goods and food safety. And they argued that for the sake of guaranteeing such "gate-keeping" controls, those checks could never be outsourced to a third country.

Yet with the new Brexit deal that is exactly what happens: It is U.K. authorities who will check goods going from British ports to Northern Ireland and from thereon potentially into the EU single market. It is British customs officers who'll have to decide whether goods need to pay EU tariffs or not (because it can be supposedly assured they will not continue in the EU.) And British vets will do the critical animal welfare and food safety checks at the border too, ensuring that no sick cow or rotten beef enters EU territory.

Asked by reporters why the EU had crossed its own red line on customs, Barnier offered this excuse: "A unique situation must be dealt with using exceptional solutions."

That amounts to a significant move on the EU's part: Even last week, Barnier stressed the importance of "serious and rigorous customs and regulatory checks at every border of our single market and customs union." He added: "It is the credibility of the single market that is in question, and therefore its credibility vis-à-vis consumers, businesses and third countries with whom we have agreements."

EU diplomats were even more specific, saying the bloc could not allow U.K. authorities to run such checks — especially when London is flirting with deregulating things like genetically modified food in preparation for a future trade deal with the United States.

One diplomat recalled two weeks ago that it was British authorities who had failed to get a grip on mad cow disease in 1996 and foot-and-mouth in 2001, which then spread to Ireland and the rest of the EU. British customs also faced major embarrassment over a giant Chinese fraud network which led to a €2.7 billion fine by the EU's anti-fraud office.

Bernd Lange, chair of the European Parliament's trade committee, openly questioned Thursday whether British authorities would have "sufficient resources and will" to properly vet products going into the EU.

Asked by reporters why the EU had crossed its own red line on customs, Barnier offered this excuse: "A unique situation must be dealt with using exceptional solutions."

Northern Ireland backstop

The backstop, the insurance mechanism intended to prevent the recreation of a hard border between Ireland and Northern Ireland, had been one of most contentious points in the Brexit process. It was roundly rejected by Brexiteers, who saw it as an attack on U.K. sovereignty because (in its original formulation) it would have required Northern Ireland alone to remain in the EU's single market and customs union.

Opposition to the backstop was so fierce that EU negotiators shifted stance and granted May’s request for a U.K.-wide backstop plan. From that point on, they said the backstop was sacrosanct and could not possibly replaced.

Until it was.

For months after Johnson insisted the backstop would have to go, EU leaders insisted there was no workable alternative. When the U.K. pushed for a time limit on the backstop, the EU27, led by Ireland, said that was impossible.

They insisted it needed to be an “all-weather” backstop insurance, iron-clad and unchangeable, unless and until it was superseded by a future free-trade agreement. In the end, it turned out there was enough chocolate in Belgium to make a very special type of fudge.

Johnson proposed a mechanism to give the Northern Ireland institutions a say over it to make it more democratic — effectively granting the joint executive at Stormont veto power. The EU objected to the veto, but gave in on the idea of the consent mechanism.

The solution was to shift from a time limit to what officials now call an “event limit” — meaning a simple majority of the Northern Irish Assembly can vote to abandon the new, special customs arrangement after four years. It’s not a veto, but it is consent, and it allows Johnson to boast that he demolished the “undemocratic” backstop and gave the people of Northern Ireland a say over their own fate.

For their part, some in the EU are warming to the new backstop replacement. “It’s much easier than a time limit,” one EU diplomat said, “because we can talk to people and convince them.”

This article is part of POLITICO Pro’s premium Brexit service for professionals: Brexit Pro. To test our our expert policy coverage of the implications and next steps per industry, email pro@politico.eu for a complimentary trial.