LONDON -- Facing a sudden surge in public opposition to the war in Afghanistan, Prime Minister Gordon Brown delivered a stinging rebuke Friday to the government in Kabul, threatening to withhold additional British troops if it did not act swiftly to combat widespread corruption.

Brown called on the administration of President Hamid Karzai to take dramatic steps to clean up government in the wake of flawed elections, including the creation of a new, independent anticorruption commission with investigative and prosecutorial powers. Brown's comments came as the British were jolted this week by a string of new causalities in Afghanistan. "I am not prepared to put the lives of British men and women in harm's way for a government that does not stand up against corruption," Brown said.

It marked the most direct threat yet from the British -- who maintain the largest number of troops in Afghanistan after the United States -- to reconsider their support for Karzai. As the Obama administration seeks to recalibrate the war effort, the British are also contemplating sending an additional 500 troops there, bringing their total to 9,500.

Yet Brown also delivered an impassioned defense of the war at large aimed at an increasingly skeptical British public, calling the effort vital to national security. Britain, Brown said during his speech at the Royal College of Defense Studies in London, "cannot, must not and will not walk away" from Afghanistan.

Brown's policy speech came after seven British soldiers were killed in Afghanistan this week. They included five causalities Tuesday when a renegade Afghan police officer turned on British soldiers with a machine gun while they were drinking a cup of tea. The gunman escaped on a motor bike.

The soldiers were living and working in a police camp as part of the British mission to train Afghan national security officers; a role Brown said British troops would continue to play. "We have not chosen the path of training and mentoring the Afghan forces because it is an easier or safer alternative -- often it is the opposite -- but because it is the right strategy," Brown said.

Yet the incident has inflamed hitherto-muted British opposition to the war. A new poll showed 35 percent here now favor an immediate withdrawal of all British troops, compared with 25 percent just two weeks ago. Only 20 percent said troops should remain in the country "as long as Afghanistan's government wants them there," compared with 29 percent two weeks ago. A majority of Britons now believe the war cannot be won, according to the YouGov survey.

There are several reasons for the shift in opinion here -- first and foremost being the mounting British death toll in Afghanistan, now at 230 since the invasion in 2001. But in addition, analysts say, the public has grown frustrated with ill-defined mission statements from government leaders, a lack of military hardware for their troops and the sense that the British are fighting to defend an Afghan government rife with corruption.

"The question the public is asking is why are our troops dying for some corrupt, illegitimate ruler in the form of Karzai," said Gareth Price, head of the Asia Program at Chatham House, a London-based think tank.

Brown, facing rock-bottom approval ratings that have threatened his government, sought to assuage public anger by demanding that Karzai make immediate improvements in five key areas. The Afghan government, Brown said, must fight corruption, strengthen domestic security forces, promote reconciliation, encourage economic development and cultivate better ties with its neighbors.

"If the government fails to meet these five tests," Brown said, "it will have not only failed its own people, it will have forfeited its right to international support."