London, England (CNN) -- In a major speech on Afghanistan, British Prime Minister Gordon Brown said Friday that Britain "cannot, must not, and will not walk away" from its mission there.
But Brown also warned that reform in Afghanistan is necessary if British troops are to remain.
"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.
The prime minister spoke three days after an Afghan National Police officer opened fire on the British troops who were training him, killing five British soldiers and wounding six others.
Their deaths brought to 93 the number of British service personnel killed in Afghanistan this year, Brown said. Britain has 9,000 troops in the country.
Brown said the fight in Afghanistan must continue because the main terrorist threat facing Britain comes from both Afghanistan and Pakistan. He said three-quarters of all terrorist plots originate from the two countries' shared border region.
"Our mission must not fail," Brown said. "It is not easy, the choices are not simple, there is no strategy that is without danger and risk, but that is the responsibility of leadership of government and of our armed forces -- to do what is necessary, however difficult, to keep the British people safe.
"We cannot, must not, and will not walk away," Brown said.
Brown put pressure on Afghan President Hamid Karzai, who recently won a second term after an election widely marred by fraud, to clean up his new government. Karzai's main challenger dropped out of the vote because of alleged corruption.
"People are right to ask whether our soldiers should be placed in harm's way if the government of Afghanistan is unable or unwilling to meet its obligations to the Afghan people," Brown said.
Brown said he has told Karzai to make a "contract with the Afghan people" against which they can measure his success. Brown said he also proposed that Karzai enact a new anti-corruption law that allows for investigation and prosecution.
Karzai promised to take "decisive action against corruption," the prime minister said.
"Good governance is more, of course, than the absence of corruption -- it is about having properly qualified men and women in the key jobs," Brown said. "The world will be monitoring the new government's appointments (of) cabinet ministers and provincial governors to ensure that they are based on merit. Cronies and warlords should have no place in the future of a democratic Afghanistan."
Still, Brown said Britain's presence in Afghanistan is justified because it focuses on strengthening local authorities to enable them to fight the Taliban and al Qaeda.
"Our strategy emphasizes the need to strengthen the legitimate authorities in both Afghanistan and Pakistan," Brown said. It recognizes that we cannot succeed in one country without succeeding in the other."
That strategy has gone from "straightforward counterterrorism to more complex counterinsurgency," Brown said. It includes the type of mentoring that the British troops killed this week were engaged in with Afghan police, he said.
Some 400 British troops are now involved in mentoring and training the Afghan military, and about 100 are working with Afghan police, Brown said.
"We will not give up this strategy of mentoring. It is what distinguishes a liberating army from an army of occupation," Brown said.
Brown also used his speech to defend equipment levels for British troops, which some have criticized as too low.
A memo from a British officer killed this year in southern Afghanistan, made public last Saturday, warned that a shortage of helicopters was putting British troops at risk because it forced them to travel overground, increasing the chances they could be killed by a roadside bomb.
Lt. Col. Rupert Thorneloe wrote the military memo June 5, less than a month before he was killed in a roadside bombing.
Thorneloe remains the highest-ranking British serviceman to die in combat since the 1982 Falklands War.
Brown has repeatedly said that a shortage of helicopters is not leading to more deaths in Afghanistan.
Friday, Brown acknowledged that roadside bombs are the deadliest challenge still facing British forces, and said such attacks have more than doubled over the past year. But rather than avoiding the bombs, Brown said finding and dismantling the groups that lay them should be the priority.
"What separates successful counterinsurgency from unsuccessful counterinsurgency is that it is won on the ground, and not in the air," Brown said.
It is wrong to question the British government's commitment to pay for military equipment, Brown said, citing the purchase of more military and armored vehicles for the theater.
"I am determined that while it is inevitable that conditions change and our strategy must respond, the fundamental principle must remain that every soldier and unit deployed to Afghanistan is fully equipped