She had one last grubby trick to pull. As the hours ticked down to the moment Britain was supposed to leave the EU, Theresa May forced another vote on her deal.

She told the Commons it wasn't really her deal at all. She claimed that supporting it would not prevent MPs from altering the overall Brexit package. She pretended that she was just trying to ensure an orderly exit. It was all a lie, nearly every word of it. Each sentence was constructed to mask the reality of what she was pursuing.

In reality, she was trying to fool MPs into eradicating any possible further extensions of Article 50. She was corralling them towards the cliff edge - stripping away alternatives and forcing them to choose between her deal and the abyss.

The strategy was simple but quite effective. She simply split the deal in two.

It is made up of two elements: the withdrawal agreement, which is the legal treaty on the divorce from Europe, and the future relationship document, which is a collection of political promises for the future.

Breaking them off from one another achieved three things. First, it allowed her to put it in front of MPs again, as it sidestepped the Speaker's ruling that she could not keep on putting the same motion to the Commons over and over again. Second, it allowed her to pretend that the eventual future relationship could be negotiated with parliament, in a bid to bring wavering Labour MPs onside. Third, and most importantly, it let her game the extension offer from the EU to her own grim advantage.

Brussels had offered two separate extension deadlines. The first, which applied if she got her deal through, was a technical extension. It would last until May 22nd and give time for the government to pass the legislation needed to enact her deal at a domestic level. The second, which applied if no deal had been agreed, lasted until April 12th.

Both dates were defined by the European elections, which are tabled for May 23rd. The EU cannot allow the UK to remain a member of the EU after that date unless it takes part, or else it risks its parliament being illegally constituted. So the first extension was based on the date of the election. The second extension was based on the last date the UK would need to pass laws so it could take part in them. In reality, the EU expects Britain to make a further request before this date if there is no deal, at which point a longer extension is likely to be offered.

But there was a wrinkle in the text which May took full advantage of: the definition of 'deal' in the EU position was just the withdrawal agreement, not the future relationship document. All May had to do was get that part through. Then she could work down the clock until April 12th and, once that date was passed, it would no longer be possible for the UK to take part in the elections. That would put her exactly where she wanted to be. No further extensions to Article 50 would be possible. May 22nd would become an immovable exit day.

Instead of putting forward her deal again, she would treat today's vote as validation and simply lay down the legislation turning it into domestic law. There'd be no more escape routes. All the promises and assurances would be gone. She would be able to threaten MPs that they had to back her plan or accept the abyss. It was a clever and deeply cynical bit of procedural deception.

This tactic brought several hardline Brexiters onside. Jacob Rees Mogg, Boris Johnson, Dominic Raab and countless others fell into line. But they weren't really supporting the deal. Their change of heart was as misleading as the prime minister's offer.

"It is very painful to vote for this deal," Johnson said. "But I hope we can now work together to remedy its defects, avoid the backstop trap and strive to deliver the Brexit people voted for." But the backstop, as he knew, was an integral part of the deal. He clearly intended to sabotage the withdrawal agreement he was voting for. Iain Duncan Smith had the same idea, as did Raab. It was even being not-so-subtly promoted by Brexit secretary Stephen Barclay.

Their plan was to back the withdrawal agreement, wait for April 12th to pass, then attack the legislation - either defeating it or simply holding it up until Britain finally fell out the EU on May 22nd. May had made another Faustian pact, her second in a week. Both her and the ERG were cooperating on ruling out any further extensions of Article 50. Then they would go to war with each other once their mutual enemies in the Remain and Soft Brexit camps had been defeated.

The cynicism and basic failure of patriotic responsibility is almost beyond comprehension. The whole status of the nation - its legal structure, its trading systems, its regulatory arrangements, its livelihood, its reputation, and the legal status of millions of the people who live in it - all of it was being put at stake in some demented game of Chicken between Downing Street and its backbenchers.

But that was all for later. For today, they worked together in a last attempt to neutralise parliament.

As the day wore on, it started to look perilously close. One after another, the ERG folded. It was a grim spectacle, watching all these men who talk of nothing else but their love of country suddenly back a deal they said sold the nation into slavery. In the morning, reports started swirling around Westminster that Labour MPs with Leave constituencies were going to buckle. For a couple of hours, it seemed like all might be lost.

But then the tide turned. The DUP held firm. A number of hardline ERG figures, like John Baron, John Redwood and Bernard Jenkins, refused to move. Labour MPs consolidated. Many had been put off by May's promise to quit on Monday, which meant that voting for the deal cleared the way for hardline Brexiters like Johnson to take the leadership position. Once again, the prime minister's catastrophically inept tactical gambits prove the best opposition to her intentions.

The government was defeated by 286 votes to 344. A total of 34 Tories rebelled - some from the ERG, some from the moderate wing. It was down from 75 last time and 115 the time before that. Only a handful of Labour MPs switched.

May stood up afterwards and, in her usual way, without even a glimmer of contrition or self-awareness, castigated parliament for opposing her. "The implications of the House'’s decision are grave," she said. "I fear we are reaching the limits of this process."

But in truth, it was a profound moment of defeat. This was her last-gasp effort. Where can she go now? Bercow will not allow her to put the deal forward again, either in full or as a withdrawal agreement. She's pretty much out of tricks.

On Monday, MPs take control again. There will be a second day to debate and vote on Brexit alternatives. The results from this week showed that a customs union has a lot of support, as does a public vote on the deal. Others are talking about trying to combine the customs union proposal with the single market. Some want a general election.

All of these ideas have flaws. But every single one of them is better than where we are now. And crucially, all require that we extend Article 50 for a longer period, probably until the end of the year.

That is the next stage of this process: Finding a potential solution and taking it to the EU as part of the extension request. Customs union and single market changes require an alteration of the future relationship document, which takes time to negotiate. A referendum or general election take time to hold. Whatever happens, a longer extension must now be requested.

That is a huge victory for Remainers and critics of Brexit.

At 11pm tonight, Britain was due to leave the EU. The commemorative T-shirts and plates made for the occasion now look like a bad joke. The parties in Westminster have been cancelled. Over and over again, Brexiters in government sneered at and mocked those who thought it could be prevented. The date was set in stone, like a commandment from God. But when the clock hits 11, nothing will happen. Britain will still be in the EU. They failed.

The grim events of today, the lies and procedural trickery, were a desperate last attempt to kill the insurgency against the government, both from parliament and the popular movement online and on the streets. That failed too.

Now opponents have the wind in their sails. They can secure a longer extension. They can, if they work together and with an open mind, find alternatives on Monday, and force them through. The prime minister's options are limited but theirs are many.

This was supposed to be Brexit day. That's not the way it turned out. Remainers and Soft Brexiters now have the advantage.

Ian Dunt is editor of Politics.co.uk and the author of Brexit: What The Hell Happens Now?

The opinions in Politics.co.uk's Comment and Analysis section are those of the author and are no reflection of the views of the website or its owners.