Updated

British Prime Minister Gordon Brown narrowly won an important vote Wednesday on plans for tougher new terrorism laws after he warned that failing to increase police powers risked undermining the country's security.

Brown staked his political credibility on winning police more time to hold terrorism suspects — and investigate alleged plots — before the suspects need to be charged or released.

Following months of debate, lawmakers voted 315 to 306 to approve plans to increase the time — from 28 days to six weeks — police can hold suspected terrorists without charging them with anything.

It appeared that the votes of nine minor party legislators from Northern Ireland, secured in talks with Brown just hours before the vote, ensured victory.

The decision offers Brown respite after a troubling few months that have brought heavy losses in municipal elections and embarrassing policy gaffes.

But his struggle to win the vote underscored the fragility of his grip on power.

He courted dozens of lawmakers Wednesday in meetings and on the phone. Some surprised legislators said they hadn't heard from Brown in years.

Foreign Secretary David Miliband was ordered to cut off a Middle East tour to vote, risking offense by canceling talks with Prime Minister Ehud Olmert at short notice.

But Brown's frantic effort came with good reason. His Labour Party is far behind the Conservatives in most polls and needs a swift revival before a likely 2010 national election.

Brown's proposal must now be passed by peers in Britain's House of Lords.

Though some in Britain's upper chamber have threatened to try to block the laws, the prime minister could use rarely deployed legislation to force his proposals through, with or without their backing.

An alliance of libertarians, lawyers, right-of-center lawmakers, and activists opposed Brown's plans, claiming the proposal was unnecessary and an affront to liberties. An estimated 37 of Brown's own Labour lawmakers voted against his plans.

Blair's former chief legal adviser, Lord Goldsmith, had said the proposals could strain relations with Britain's Muslims and choke off a vital flow of intelligence to police.

Some critics saw the issue as part of a fight to balance civil liberties and national security — following skirmishes on the use of police profiling, DNA and plans to introduce identity cards in the U.K. for the first time since World War II.

Brown insisted police need more time to crack encrypted computers, chase leads across the globe and map out sprawling terrorist networks.

Officers investigating an alleged 2006 plot to blow up at least seven trans-Atlantic airliners needed to trawl through 400 computers and 6,000 gigabytes of data, Brown said.

Most police chiefs and some victims of terrorism have backed Brown's plans. Graham Foulkes, whose 22-year-old son, David, was killed in the July 7, 2005, bombing attack on London's transport network, said a majority of the public supports tougher laws.

"Forty-two days is not a lot of a price to pay, particularly when we know the alternative," Foulkes said.

Two former MI6 officers, Baroness Park and Baroness Ramsay, were quoted by The Times of London on Wednesday as saying they backed Brown.

"Voting against 42 days increases the odds in favor of the terrorists," said Ramsay, according to the newspaper. Ramsay staffed the overseas intelligence service's Iraq desk during the first Gulf War in the 1990s.