It was an unprecedented spectacle. When Theresa May rose to her feet to finally open the Commons debate on her Brexit deal this evening, she had just been defeated in three votes, one after another, in a punishing moment of political humiliation. There was no breathing room. It was relentless.

The first vote came in the late afternoon. The government had tried to use a delay-gambit to fight off a motion branding it in contempt of parliament. Even that was astonishing The idea a government would even face a vote like this was bad enough. The idea it might lose it was shameful on a genuinely historic level.

There were weeks of build-up to this. It began because May refused to publish the legal advice on her Brexit deal. So last month, Labour held a 'humble address' vote in parliament to force the government to publish it. The government, fearing it would lose, simply did not turn up. So it lost. It then pretended the vote simply hadn't happened and proceeded to ignore it.

Yesterday, the attorney general went to the Commons and offered his summary of the advice - but not the advice itself. Labour shadow Brexit secretary Keir Starmer wrote a motion saying the government was in contempt of parliament. He was providing an important constitutional lesson for an administration which often uses democratic rhetoric without abiding by the standards it entails.

Parliament is sovereign. It represents the views of the British public. It is the boss of government, not the other way round.

The delay-gambit failed. MPs voted against it by 311 to 307. The government's defence was shattered. Then came the charge, in the form of a vote on the motion itself. Again MPs defeated the government, this time by 311 to 293. The government was officially found in contempt of parliament, for the first time in British history.

It is an indelible stain on its reputation. It had tried to keep legal advice secret. It had tried to undermine parliament by simply refusing to fight. It had tried to ignore what parliament eventually decided.

Even at the last minute, it could have prevented this outcome. It could have offered to publish the advice. It could have sorted things out with Labour behind the scenes. It could have followed a compromise plan put forward in the early parts of the debate by Ken Clarke in which it would share the document with Labour, on Privy Council terms, and agree the sections to be redacted in the national interest. But it did not. It is a relic of a government, incapable of changing its own position or adapting to circumstance. It's a broken monolith: dull, shattered and functionless.

Worse was yet to come. Next, MPs voted on an amendment put forward by Dominic Grieve. He had had some bad experiences with the government. Earlier in the year, he was trying to imagine what would happen if May failed to get her deal through parliament. He wanted a meaninful vote, right at the end of the process, so MPs would have a chance to avoid no-deal.

Just like on the humble address, the government thought it would lose. So it brought Grieve in and told him it would do what he wanted. But when he eventually saw their compromise he realised they'd pulled a fast one. The so-called 'meaningful vote was to be put in nuetral terms. That meant MPs couldn't amend it. And if they couldn't amend it, they couldn't stop no-deal or have any real voice in the process.

So this time Grieve introduced a new amendment, ensuring any vote would allow amendments. And he wouldn't give way. He knew now not to trust promises from Downing Street.

"This whole process has shown the government's marked reluctance to listen to the House," Hilary Benn, who wrote a similar amendment, told the Commons. "And I suspect that what the government has sown it shall reap."

Within minutes he would be proved right. MPs voted for the amendment by 321 to 299.

This was a hugely significant moment, arguably one of the most pivotal in the entire Brexit process. If May fails to get her deal through parliament, she is under a statutory obligation to make a statement to the House within a set number of days. And that statement will be followed by a vote that is now amendable.

That means MPs can use it to demand the government extends Article 50, or holds a second referendum, or revokes the Article 50 notification altogether. That won't be sufficient on its own. Legislation would be required after that. But this is how they can start the change of course.

Parliament is finally taking back control. For two and a half years, MPs have trembled under the tyranny of an imaginary 'will of the people'. This never existed. People voted different ways for different reasons. But the government seized on the idea and used it to justify whatever action it happened to be taking, with the help of a largely compliant press and national broadcaster. Any MP, or peer, or judge, who had the temerity of challenging this executive power had the dogs of culture war set on them.

Now, finally, this poisonous spell of populism channeled through an over-powerful executive seems to have been broken. May's deal is driving relentlessly towards defeat. Given what we saw today, it seems almost impossible that she will pass it. If so, there are now, for the first time, real democratic checkpoints in which MPs can prevent no-deal.

The edifice has crumbled and it looks set to collapse. MPs have found their bravery. It's game on.

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.