Uproar in the House of Commons as the result is announced
Prime Minister Gordon Brown has narrowly won a House of Commons vote on extending the maximum time police can hold terror suspects to 42 days.
Thirty-six Labour MPs joined forces with Conservatives and Lib Dems to vote against the proposals.
But that was not enough to defeat them - although the government still faces a battle in the House of Lords.
The 42-day proposal was passed by 315 MPs to 306 - with votes by the nine DUP MPs proving crucial.
Six SNP MPs also voted against the proposal, as did three Plaid Cymru MPs and three from the Northern Ireland-based SDLP.
But there was uproar in the Commons as the result of the key vote on 42 days was announced after five hours of tense debate - with Tory and Lib Dem MPs shouting "You've been bought" at the DUP benches.
They claim the DUP was offered a string of inducements - including extra financial help for Northern Ireland - to guarantee its support.
HOW THEY VOTED
Lib Dem and Tories voted against the government
36 Labour MPs voted against the government
Seven ex-ministers defied the Labour whip: Frank Dobson, Mark Fisher, Kate Hoey, Glenda Jackson, Peter Kilfoyle, Michael Meacher, and Chris Mullin
All nine Democratic Unionist MPs backed the government. They were: Gregory Campbell, Nigel Dodds, Jeffrey Donaldson, The Rev William McCrea, The Rev Ian Paisley, Iris Robinson, Peter Robinson, David Simpson, Sammy Wilson
The only Tory MP to back the government was former Home Office minister Ann Widdecombe
Labour rebels claimed the DUP had obtained guarantees that the government would block efforts to use the Human Embryology and Fertility Bill, currently going through Parliament, to loosen abortion rules in Northern Ireland.
They are also said to have cut a deal to keep revenue from water rates, which Westminster had been set to claw back.
But the DUP denies it was promised any financial support and insists it voted out of principle.
DUP MP Rev William McCrea said: "The issue was on national security."
Northern Ireland Secretary Shaun Woodward told the BBC: "There was no deal. There is no deal. They decided on principle. They made up their own minds."
For the Conservatives, shadow home secretary David Davis the government had lost the argument "hands down" but had "bought the vote".
And he vowed to fight it in the Lords - predicting the 42-day proposal would never become law.
"It has no authority, it has no legitimacy and it will be thrown out," he added.
Lib Dem home affairs spokesman Chris Huhne said the manner of Labour's victory had been "astonishing" - and for them to rely on the DUP to get such a crucial vote through the Commons would "have been laughed out of court a few weeks ago".
The sole Ulster Unionist MP, Lady Hermon, voted with the government.
Home Office minister Tony McNulty acknowledged the government still faced a battle to get 42-day detention on to the statute books.
Any attempt to present this as some sort of victory for the government will ring absolutely hollow
"I accept fully that I continue to have a real job with some 30 or so of my colleagues to show that this is the way to go, that this is proportionate and accords with civil liberties and democracy.
"I don't profess it [the 42-days proposal] to be in a perfect state yet."
He added that he wanted to talk to Labour colleagues and opposition MPs to see "how this reserve power can be put through both houses in a consensual fashion."
Keith Vaz, Labour chairman of the Home Affairs Committee, defended Home Secretary Jacqui Smith for offering concessions to MPs in an attempt to win them over.
Shadow home secretary David Davis gives his reaction
"That is the nature of government. How dreadful it would be that the government should decide on a particular course of action and then not consult with anyone else," he said.
Tony Lloyd, chairman of the Parliamentary Labour Party, said the result leaves the government "very much in tune with what the nation wants" and accuses other parties of acting "opportunistically".
And Lord Carlile, the government's independent reviewer of anti-terror legislation, said he was "satisfied that Parliament has done the right thing".
But one of the Labour rebels, John McDonnell, said: "Any attempt to present this as some sort of victory for the government will ring absolutely hollow.
"There will be widespread consternation among our supporters in the country seeing a Labour government prepared to use every tactic available in its determination to crush essential civil liberties, which have been won by the labour movement over generations."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.