LONDON — The unraveling of Boris Johnson’s Brexit masterplan can be traced back to one key miscalculation.

When MPs returned to Westminster four weeks ago, the expectation in Downing Street was, according to several senior officials and ministers, that the prime minister’s opponents were likely to succeed in their bid to pass a new law blocking a no-deal Brexit and thus jeopardize Johnson’s promise to pull the U.K. out of the European Union on October 31 “do or die.”

Like the Joker in the film “The Dark Knight,” Johnson wanted to get caught.

The new law would give him an excuse to call a pre-Brexit election for mid-October, which he would frame as a fight between the people and parliament, with Johnson blasting MPs for attempting to block Brexit. His hope was to win back the Tory majority his predecessor Theresa May lost in 2017, which would allow him to push for a new deal in Brussels or settle for no-deal with authority.

Either way, his core promise of leaving on October 31 — made on Johnson’s first day in office and repeated ad nauseam ever since — would be kept, and the Conservatives would be able to preside over post-Brexit Britain until the next election in mid-2020s.

“Corbyn being persuaded not to go for an election was a significant moment" — A senior government official

It almost worked. MPs duly voted to block a no-deal Brexit, and Johnson in turn, with great shows of reluctance, said an election was now the only option. But then something happened that was not in the script.

The plan was predicated, say those familiar with thinking in No. 10, on the idea that the opposition Labour Party would not duck a pre-Brexit election in mid-October.

But then, on September 4, Labour leader Jeremy Corbyn did just that, denying the prime minister the two-thirds parliamentary majority required for an election to take place under U.K. law. The move forced Johnson to shift to Plan B: a desperate scrabble for a deal with the EU before October 19 to avoid being forced to break his promise by asking Brussels for a Brexit delay, as mandated by the new law.

That Labour would not vote for an election was, according to several senior officials and ministers who spoke to POLITICO on condition of anonymity, the defining strategic miscalculation of Johnson’s tenure — and its knock-on effects have been far-reaching.

“The major miscalculation was that opposition parties who have called for an election repeatedly would vote for one when given the opportunity,” said a senior minister. “They didn’t.”

Yet again on Wednesday, the prime minister was thwarted in an effort to secure an election, as Labour and other opposition parties continued to demand that the Brexit extension comes into force first – leaving the prime minister with increasingly few good options if he wants to deliver on his promise, and stay in office.

Knives out for Cummings

Tuesday’s dramatic U.K. Supreme Court ruling that Johnson broke the law when he advised the queen to suspend parliament for five weeks — and the resulting recall of the House of Commons — has deepened the gloom in Downing Street and led to further questions about one of the key architects of Johnson’s strategy, Dominic Cummings.

One senior minister said Cummings, a senior Johnson adviser, had been central to the plan to suspend parliament — and in the decision to sack 21 Conservative MPs who defied Johnson with votes to block a no-deal Brexit.

The minister said they had noted that Johnson’s other senior adviser, Eddie Lister, had in recent days and weeks appeared to be taking a bigger role in Johnson’s decision-making. Lister, a former London council leader who served as chief of staff to Johnson during his tenure as London mayor, accompanied Johnson during his trip to Biarritz, France for the G7 summit and to the United Nations in New York. He has also been ensuring Downing Street maintains good ties with U.K. businesses, who are deeply worried about the prospect of a hard Brexit.

“Lister is a grown- up. He has been elected,” the minister said. “There is something about people who have been elected by people and people who have never had to do it, and that is the key difference between [Cummings and Lister],” said the minister, who is critical of Cummings’ confrontational style.

Which of the two is more senior has never been made explicit by Downing Street, something reflected in confusion about their titles. Lister was initially reported to be “chief of staff” but this was then contradicted. One official said that Cummings’ name badge for a recent event had called him “senior assistant to the prime minister.”

What is clear is that while Lister takes the lead on external relations, Cummings is the key figure powering the government’s drive for no-deal, which has seen no let-up. He runs daily meetings of a Cabinet committee called exit operations (XO), where a planning matrix known as “the dashboard” displays priority projects for preparing the U.K. for a hard Brexit.

While Downing Street has cultivated an image of Cummings as somehow omniscient, the botched plan for a mid-October election has led to increasing questions about his strategy.

“Corbyn being persuaded not to go for an election was a significant moment,” said a senior government official. Did Cummings — the arch-strategist, a devotee of game theory, the political stratagems of Otto von Bismarck and computer chess — not see it coming? “You never know with Dom,” the official said.

"Leaving on October 31, deal or no deal, is something we’ll never change our strategy on" — UK government official

Another official played down the importance of the misjudging Labour, insisting that the government has always been acutely aware of the need to adapt their strategy to unpredictable events.

“Most corners you turn there’s the risk of being boxed in and you have to be light on your feet and change direction if required. But there are fundamentals that won’t change. Leaving on October 31, deal or no deal, is something we’ll never change our strategy on,” the official said.

The prime minister, a U.K. government official said, still has full confidence in Cummings.

What now?

An election could still come about if and when opposition parties decide to hold a vote of no confidence in the government, something Corbyn reiterated on Wednesday he would only do after a Brexit extension — until January 2020 — has been secured.

On Wednesday, as MPs returned to parliament following the Supreme Court ruling, there were suggestions from Attorney General Geoffrey Cox that the government might push again for an early election. But Labour remains deeply suspicious that Johnson will seek to wriggle out of the law — the Benn Act — that requires him to request a Brexit extension. The party will not back an election until it is convinced that the Brexit delay is locked in and legally watertight, a party official said. That could require the prime minister to ask for an extension, and have it granted by the EU, before Labour agrees to an election.

The crucial point is that it’s the opposition, not the government, that feels it has the whip hand over the timing of an election.

Senior government officials now speak gloomily about the prospect of a Brexit delay being forced on them next month, and then being dragged into an election after all — but one in which Johnson’s October 31 pledge has been broken.

“I don’t think it’s a great position to be in, I think we’ll just be painted as another Theresa May,” one senior Conservative aide said.

“If we do not see Brexit by October 31, a lot of colleagues will be very concerned about going to the country because of the looming presence of the Brexit Party" — Tory MP

Conservative MPs fear the Brexit Party led by Nigel Farage would, in this scenario, cry Brexit betrayal and devastate the Tory vote, just as they did in the spring’s European election, when May’s Conservatives fell to fifth place. This could potentially allow the pro-second referendum Labour Party and the pro-Remain Liberal Democrats to steal a march on the Tories and keep them out of power.

“If we do not see Brexit by October 31, a lot of colleagues will be very concerned about going to the country because of the looming presence of the Brexit Party,” said one MP and former Cabinet minister. “There is concern that we will be seen to have failed and that the only way to deliver Brexit will be to switch to the Brexit Party, which will mean the loss of a lot of Conservative seats.”

If Johnson can’t get a deal with the EU by October 19 — and he has made only modest progress in talks — he could face a choice between this unenviable scenario, or a radical alternative: resign rather than enact the law — passed by MPs earlier this month — that demands he delay Brexit.

UK NATIONAL PARLIAMENT ELECTION POLL OF POLLS

For more polling data from across Europe visit POLITICO Poll of Polls.

Government officials now privately say this a genuine possibility, even as Downing Street publicly rules it out.

After his chastening defeat in the Supreme Court, Johnson may think twice about trying to defy the law a second time by simply refusing to abide by the Benn Act, said Charles Grant, director of the Centre for European Reform think tank.

“Some people seem to think he’d rather not [sign the letter to the EU requesting an extension] and that he won’t break the law, he’ll just resign. If he resigns then he will let somebody else do it,” he said.

The logic of such a move would be to make way for a caretaker government that would request the Brexit delay and then call an election (Corbyn has stated his willingness to do exactly this.) Johnson, having maintained his Brexit purity, could then lead the Tories into that election having, to some extent, blunted the impact of the Brexit Party on the Conservative vote.

“The risk of that for Boris is a kind of Salvini situation,” Grant said, referring to the Italian League party leader who pulled the plug on his country’s coalition government last month in the hope of winning a majority in a subsequent election, but instead found himself frozen out of power.

“[Johnson could] resign thinking there will be an election in a few weeks’ time and you can get back in by winning the election,” he said. “But then maybe the caretaker government goes on being a caretaker government for a very long time and you’re excluded from power and there isn’t any election.”

If that scenario came to pass, it would represent the final ruin of the Downing Street strategy. For now, Johnson is still in the game — but he has learned that one simple miscalculation can bring you very close to check-mate.

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