(CNN) Boris Johnson keeps saying he really, really doesn't want an election . In reality, he wants nothing more. It's the only way out of the Brexit mess he finds himself in.

The British Prime Minister has been cornered by his own political missteps and parliamentary defeats . He is still insisting he will take the UK out of the European Union on October 31 -- with or without a deal. But his negotiations with the EU appear more or less dead in the water and Parliament passed a bill this week that requires him to ask the EU for an extension if no agreement is reached.

Johnson said he would rather be "dead in a ditch" than ask for a delay but also refused to say he'd resign if it got to that point. He wrote to Conservative MPs to say that asking the EU for a Brexit extension "is something I will never do," reported the Daily Telegraph, which saw a copy of the letter he sent on Friday night.

But barring the possibility of knowingly breaking the law, an election is the only way he can keep his word.

The election option

It looks like a good idea. Johnson is ahead in the polls and if he could secure a larger majority, his problems would -- at least partially -- disappear.

The problem: It's not up to Boris Johnson to decide when Brits go to the polls.

Under the Fixed-term Parliaments Act of 2011, the law that sets the rules on how election is called, at least two-thirds of lawmakers need to support a call for an early vote.

Johnson lost his first bid to hold an election on Wednesday, but decided to schedule another vote on the issue in the House of Commons on Monday. Opposition parties came out with an unusually united front on Friday, saying they would not support it.

Johnson could try to bypass the super-majority hurdle by putting down a new piece of legislation that would effectively override the current election law. A one-line bill would suffice, saying something along the lines of "notwithstanding the Fixed-term Parliaments Act, the election will be held on day X."

"The advantage there is that you would only need a simple majority... the disadvantage is that he doesn't have a majority anymore , so it's unlikely that that would pass either," says Ian Dunt, a British political commentator who edits the politics.co.uk wesbite.

Johnson's minority problem

The Prime Minister lost his working parliamentary majority earlier this week when a Conservative MP dramatically defected at the start of his first speech after the summer recess. Johnson then further undermined his position by firing 21 rebel Conservatives who voted against the government, in support of the bill to prevent a no-deal Brexit.

Another issue with a one-line bill is that just like any legislation in Parliament, it would be open to amendment. Johnson would risk the opposition teaming up with Conservative rebels to change the law in a way that could hurt him even more -- altering the election date, or extending the vote to 16- and 17-year-olds, a measure mooted for years but that is thought to benefit progressive parties.

The no-confidence option

A nuclear option would be to call a no-confidence vote in his own government.

"It would get him to where he possibly wants, there would be a general election, unless within 14 days his or another government can secure a confidence vote," said Ruth Fox, the director of the Hansard Society, a leading constitutional research organization.

Britain's Prime Minister Boris Johnson doesn't have many options left.

However, she points out the absurdity of that situation: "It would be extraordinary for a government to lay a motion of no confidence in itself and encourage [its] party to vote for that."

Aside of being potentially embarrassing and completely unprecedented, the move could also run afoul of the UK's unwritten constitution.

The Fixed-term Parliaments Act doesn't explicitly forbid Johnson from calling his own no confidence vote. But when that law was being passed in 2011, the then Conservative minister for constitutional reform Mark Harper said such a move would be "absolutely unconstitutional" and warned that "public would not respond well to a government behaving in that way."

That view was later endorsed by Parliament's Public Administration and Constitutional Affairs Committee. But these are unprecedented times, and that which once seemed unthinkable is now very much possible.

Corbyn's options are not much better

While Boris Johnson has spent the summer insisting he doesn't want an election only to call for one on the first day after Parliament came back, Labour leader Jeremy Corbyn has done the exact opposite.

Corbyn has been calling for an early election for months. Presented with an opportunity to hold one, he refused. Why? Because he, just like the Prime Minister, knows all too well that an election is Johnson's only way out.

Corbyn, while currently running behind Johnson in opinion polls, has some advantages. "He's much better during elections than he is the rest of the time, he sort of seems to come alive during an election ... last time that saw some improvement for him," Dunt says.

The Labour leader wants to push the election to a later date, because he is hoping that the current Brexit chaos will split the already torn apart Conservative Party further, making it more vulnerable to attacks from the more radical Brexit Party.

"He needs to do that while not upsetting people too much... it's a difficult thing to go on TV and say, you know, you want an election, but not yet," Dunt says.

He is in luck: Many other opposition lawmakers want to push any election until after the current Brexit deadline of October 31 to eliminate the risk of the UK crashing out without a deal.

Corbyn's other option is to try to put together his own administration -- the kind of "unity government" countries form when they are fighting wars or find themselves in other kinds of national crises.

Unfortunately for him, that option appears to be ruled out by the fact that quite few of the other opposition parties are not big fans of his brand of left-wing, anti-establishment politics

Corbyn has so far refused to give way to someone who would be acceptable to the Liberal Democrats, Scottish National Party and the roughly two dozen former Conservatives who have left or have been kicked out of the party by Johnson. But he may not have a choice.

"There would be a motion for Jeremy Corbyn to be the caretaker Prime Minister, and that would fail," Dunt said. "And once that fails, then he would have to think 'well, okay, so who's it going to be.'"

That could pave the way to another senior parliamentarian taking the reins for a time-limited government with the single aim of securing an extension to the Brexit process.

And what then? An election, of course.