What just happened in the Commons?

Laura Kuenssberg
Political editor
@bbclaurakon Twitter

UK and EU flags at WestminsterImage source, EPA

Wow - the government just avoided its second ever Commons defeat on key Brexit legislation.

And they nearly lost it because they had just backed down in order to avoid their second ever Commons defeat on key Brexit legislation. What?

Fair question. In simple terms this is what has happened in the last few days:

Brexiteers - not all, but enough - hate the PM's Chequers compromise.

They believe it keeps us too closely tied to the EU and should be ripped up.

They came up with four changes - or amendments - to a bill going through Parliament that in very strict terms don't get rid of the Chequers deal.

But the amendments were designed to show that the group was big enough and strong enough to stop a Chequers-style compromise from happening - an obvious warning to the PM.

Because governments don't like losing, No 10 agreed to accept those changes this afternoon, so the group of Brexiteers didn't vote against the government and beat them.

So far, so simple.

Remember the PM has (at least) two sides in her own party. And the former Remain side were so annoyed that Number 10 had given in to the Brexiteers that some of them, in rage, voted against the government instead - even if weirdly they believe they were the ones backing ministers' policies.

One government minister was so annoyed about Number 10 backing down he quit his post. And Theresa May only scraped through by three votes.

What does all that mean? It looks a mess because it is a mess. It's getting harder and harder for the prime minister to get things through Parliament - and while calls for a second referendum are widely rejected, that sentiment could change if this kind of gridlock continues.

The PM has spent the last two years trying to compromise. She has a divided party and no majority. There are no easy choices.

But the divisions in the Tory party are daily reducing her room for manoeuvre. In a debate about principle, the problem for some is that compromise is a dirty word.

One senior Tory told me "we set fire to the platform - now, we're setting all the exits alight".