Protests took place outside parliament as the debate happened in the Commons.

Historic rebel victory: Parliament moves to stop no-deal

It wasn't even that close in the end. The government was defeated by a majority of 27. Twenty-one of them – an extraordinary number – were Tory rebels.

MPs had faced down the threats, one after the other. Boris Johnson had tried to cancel parliament, but now they were taking back control. He threatened to throw rebels out the party, but they did it anyway. He tried to use the vote as a chance to trigger an election, but opposition parties, including Jeremy Corbyn, saw the trap and confirmed they'd turn the bill into law first.

Johnson was the first prime minister to lose his first Commons vote since 1894. His attempt, in alliance with his advisor Dominic Cummings, to bully parliamentarians into submission, had fallen apart. 

There are still battles to come. All today did was buy time for MPs to debate and vote on the bill stopping no-deal tomorrow. It seems unlikely the majority would slip away, but it's possible. Then it goes to the Lords, where there is a chance dedicated Brexiters can try to hold it up and cut it to death. But for the moment, it seems likely to succeed.

It will be reported as a classic Remain versus Leave battle. But actually that's not quite right. It was much bigger than that. Two visions of British governance faced each other: the overwhelmingly might of the executive, acting with the made-up legitimacy of a popular vote. And on the other side, parliamentary scrutiny – the idea the MPs people have elected must hold the government to account. Parliament won.

The rot set in early in the day. In fact, one of the main take-aways was not even the rebel victory. It was the sight of a government which, on only it's second day in parliament, looked in total disarray.

Boris Johnson issued a statement on the G7 summit in the early afternoon. He had barely started talking before Conservative MP Phillip Lee walked across the floor of the House, turned to the right, rose up the steps and sat beside Liberal Democrat leader Jo Swinson.

It was a moment of high political drama. Swinson is mercenary in how she utilises these moments for the strongest possible impact. Johnson saw him, lost his trail of thought, and suddenly there was a flicker of despair in his eyes. He had a majority of one and it was now gone, right in front of him. He literally watched it walk away.

It seemed to fundamentally destroy his confidence. For the rest of the session he was flustered, speaking so quickly he was indecipherable, punching the air with his fist, pointing his finger angrily at the opposition, often shouting in the face of calm opponents. Given that he was selected as leader for his supposed charisma, there was precious little of it on display today.

Was it just his confidence or something else? Perhaps Johnson's charm works only when he is surrounded by admirers, in Tory conference fringe events or on the after-dinner speaking circuit. The laughter buoys him up. He seems to float on it.

But now the laughter was gone. He was in the bear pit of the Commons, faced with a wall of outrage, his own party behind him silent and awkward, tearing itself apart at the seams.

A few hours later, Tory MP Oliver Letin rose to ask for an emergency standing order 24 debate. It was a unique constitutional move, a thin alley of convention which rebels bulldozed into an avenue through which they could give parliament a route into the Brexit debate. It started in the early evening, as the sun set on Westminster. In Parliament Square, a large anti-prorogation crowd gathered and started chanting.

Jacob Rees-Mogg rose for the government. It was an unspeakable disaster. It is hard to imagine a more ill-considered and inappropriate speech in any circumstances.

Not long ago, it had all seemed so jolly. Johnson's Cabinet appointments weren't really considered in any normal way. They were selected as trolling gags, intended to upset Remainers as much as possible and prove his Brexit virility. 

But now these people had to actually perform. Mogg peppered his speech with laboriously written alliteration and expressions which seemed so dated it honestly felt like it was set four hundred years ago.

"We should recognise that the people are our masters and show us to be their lieges and servants, not to place ourselves in the position of their overlords," he said. Incredible nonsense. "As we come to vote today I hope all members will contemplate the current constitutional confusion and consider the chaos this concatenation of circumstances could create."

Beyond the outright preposterousness of it, his argument was both illiterate and profoundly dangerous. He was either unaware of, or pretended not to know, the basis upon which British constitutional arrangements operate. He seemed to be arguing that, because the sovereignty of parliament is based on the popular vote, and the referendum was a kind of popular vote, it could therefore overrode any decisions MPs might make. The delivery of Brexit was up to the government, which was to pursue it without challenge.

It was, in essence, a demand for total executive control, a grotesque inversion of the entire moral basis of British democracy. And apart from being ghastly, it was profoundly alienating. Tory rebels, the exact people the government was trying to get back on side, were outraged.

"I was struck by my right honourable friend, who suddenly referred to a Man for All Seasons," rebel Dominic Grieve said, incandescent with rage. "He will recollect that Sir Thomas, when told that opposition to the king would mean death, replied: 'Well these are but devices to frighten children.'" Grieve started rubbing one hand with the other, as if about to have a fist fight. "If he thinks the device of withdrawing the whip this evening is going to change my mind or that of my right honourable friends, he has got another thing coming. It will be treated with the contempt it deserves."

One by one, they fell away. Until finally the vote came, and Johnson was humiliated.

What next for the Conservative party? Some of its most principled, intelligent, impressive figures now face being thrown out the party. David Gauke, who had never rebelled in his life. Ken Clarke, who has been a front bencher as long as many people talking about him have been alive. Alistair Burt, the minister's minister. Phillip Hammond, who was chancellor just weeks ago. And Sir Nicholas Soames, Winston Churchill's grandson.

The Conservative party is turning into something much darker, more toxic and brutal. It is now represented on the front bench by a collection of incompetents and reactionaries who cannot perform at the level government demands. Its remaining big beasts are being cast into the wilderness.

But that was of secondary importance to the constitutional fight. A dangerously populist government had tried to bully parliament into irrelevance. Parliament had fought back. For MPs, on the opposition benches, operating in line with their leadership, that will have been relatively easy. But for those 21 Tory rebels, it threatened their career, their party: everything. It required extraordinary bravery.

That sense of rebellion, that willingness to stand firm, was of the utmost historical importance.

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.