The government has suffered a major defeat on its controversial plans to hold terror suspects for up to 90 days without charge.
Despite recalling Gordon Brown and Jack Straw from abroad for the knife-edge division, the government lost by 31 votes.
In the key vote 291 MPs voted for and 322 voted against the hugely controversial measure.
Opposition parties were joined in the 'no' lobby by scores of Labour rebels in the first government defeat since Tony Blair came to office in 1997.
Instead, by a majority of 33, MPs later voted to extend the number of days suspects could be held to 28 days.
The government's proposal was by far the most contentious part of the anti-terror bill formulated in reaction to the July bombings in London.
Ministers said that the 90 day measure was put into the bill at the insistence of senior police officers who claimed it was the best way to help prevent future atrocities.
Tony Blair said he was convinced by their argument that a new kind of terrorism using suicide bombers, encrypted computers and international links meant they had swoop on suspects earlier.
Earlier in the week home secretary Charles Clarke hinted that a compromise might be possible.
But this door was slammed by the prime minister who seemed determined to push the measure through.
A concerted campaign involving friendly media outlets, opinion polls showing public support and a intense whipping operation failed to win round the opposition and Labour rebels.
Prior to the vote the home secretary told MPs that said that the tough measure was needed to deal with the complexity and severity of the threat posed by al Qaeda and associated groups.
"We are talking about a very, very small number of cases indeed, but by hypothesis [it is] some of the most dangerous people in the world that we are trying to deal with," said Clarke.
But shadow home secretary David Davis warned of the threat to fundamental civil liberties.
"What's at stake here is the imprisonment of men and women without trial, in the country that invented habeas corpus," he warned.
Charles Clarke's remarks in defence of the 90 day proposal were interrupted by a succession of backbenchers.
Labour MP Joan Ruddock said the prime minister "has sought to make this debate a simple matter of party politics".
That claim was rejected by the home secretary. "I simply don't accept the description she gives of the prime minister's motivation in this in terms of party politics," he said.
"I don't think it is accurate, I don't think it is his personal motivation and I certainly don't believe it is the motivation of the government."
Home affairs select committee chairman John Denham said the government had made up its mind to back the police's call for extended detention at a time when it had received only two documents in support of the argument, a press release and short case summary.
Pointing to this lack of supporting evidence, Denham said Clarke should not "overstate" the case for 90 days.
"In one sense I accept the rebuke," said Clarke, conceding it was important neither to overstate or understate the arguments.
"I take the point he makes, it is important to address all these things in the round."
Conservative leader Michael Howard had also intervened to say there was no proof that the 90 day detention period was justified.
He added that Clarke had "conveniently overlooked" his previous public statement that the government would table an amendment for a lower period of detention.
"How long did the prime minister have to detain him for before he decided not to proceed with that amendment?" asked Howard.
Labour backbencher Mark Fisher said the legislation would be "hugely counter-productive" in alienating Muslim communities.
But Clarke said that was "utterly wrong" as Muslim communities wanted nothing to do with terrorism.
The home secretary said the need to prevent potentially "catastrophic" terrorist attacks meant arrests were being made at an earlier stage than in other types of investigations.
And he told MPs the expert advice was that a 14 or 28 day detention period was not enough time to analyse heavily encrypted terrorist data.
Earlier, the chancellor had told the BBC he wanted to "vote in parliament on what is a vital issue of absolute and crucial importance to the country, and that's the security of the country".
"I want not only to cast my vote, but I want everybody who can cast their vote to cast their vote on the government's position," he added.