KABUL, Afghanistan (AP) - "We are in this to win," Gen. David

Petraeus said as he took the reins of an Afghan war effort troubled

by waning support, an emboldened enemy, government corruption and a

looming commitment to withdraw troops - even with no sign of

violence easing.

Petraeus, who pioneered the counterinsurgency strategy he now

oversees in Afghanistan, has just months to show progress in

turning back insurgents and convince both the Afghan people and

neighboring countries that the U.S. is committed to preventing the

country from again becoming a haven for al-Qaida and its terrorist

allies.

"We are engaged in a contest of wills," Petraeus said Sunday

as he accepted the command of U.S. and NATO forces before several

hundred U.S., coalition and Afghan officials who gathered on a

grassy area outside NATO headquarters in Kabul.

Petraeus, widely credited with turning around the U.S. war

effort in Iraq, said the Taliban and their allies are killing and

maiming civilians - even using "unwitting children to carry out

attacks" - in an attempt to undermine public confidence in the

Afghan government and the international community's ability to

prevail.

"In answer, we must demonstrate to the people and to the

Taliban that Afghan and international forces are here to safeguard

the Afghan people, and that we are in this to win," Petraeus said

on the Fourth of July, U.S. Independence Day.

Continual discussion about President Barack Obama's desire to

start withdrawing U.S. forces in July 2011 has blurred the

definition of what would constitute victory. That coupled with the

abrupt firing of Petraeus' predecessor, a move that laid bare a

rift between civilian and military efforts in the country, has

created at least the perception that the NATO mission needs to be

righted.

June was the deadliest month for the allied force since the war

began, with 102 U.S. and international troops killed. Progress in

stabilizing Taliban strongholds in the south has been slow, support

for the war is waning in the United States and allied nations, and

doubts persist about the Afghan government's willingness and

ability to fight corruption.

"After years of war, we have arrived at a critical moment,"

Petraeus said. "We must demonstrate to the Afghan people - and to

the world - that al-Qaida and its network of extremist allies will

not be allowed to once again establish sanctuaries in Afghanistan

from which they can launch attacks on the Afghan people and on

freedom-loving nations around the world."

Petraeus suggested he would refine - or at least review - the

implementation of rules under which NATO soldiers fight, including

curbs on the use of airpower and heavy weapons if civilians are at

risk, "to determine where refinements might be needed."

Some troops have complained that such restraint puts their own

lives in danger and hands the battlefield advantage to the Taliban

and their allies.

"Protecting those we are here to help nonetheless does require

killing, capturing or turning the insurgents. We will not shrink

from that," Petraeus wrote Sunday in a memo to his troops. But he

added when they got into tough situations, NATO must "employ all

assets to ensure your safety, keeping in mind, again, the

importance of avoiding civilian casualties."

The rules aimed at protecting civilians were put in place under

Petraeus' predecessor, Gen. Stanley McChrystal, who was dismissed

last month for intemperate remarks he and his aides made to Rolling

Stone magazine about Obama administration officials - mostly on the

civilian side.

Petraeus praised McChrystal early in his 10-minute speech. "The

progress made in recent months - in the face of a determined enemy

- is in many respects the result of the vision, energy and

leadership he provided," he said.

In an effort to move past the rifts between the civilian and

military camps, Petraeus reiterated the message he delivered

Saturday at the U.S. Embassy: "Cooperation is not optional."

The new commander said everyone had worked hard during

McChrystal's tenure in Afghanistan to carry out an effective

civilian-military counterinsurgency, one that Petraeus pioneered in

Iraq.

Petraeus also sought to counter skepticism, even defeatism, that

was on display last month during hearings in Washington when

lawmakers challenged Pentagon assertions that progress was being

made in the war.

He acknowledged the fight in Afghanistan has been grueling, but

insisted progress had been made: 7 million Afghan children in

school compared with fewer than 1 million a decade ago; child

immunization rates at 70 percent or higher; new roads; and bustling

economies in several cities.

When announcing the 2011 target, Obama was careful to say any

pullout decisions would be based on improved security. Yet that

caveat has often been forgotten.

Obama's timetable has provided the Afghan government the impetus

to implement reforms and bolster governance deeper into the

provinces. But it also fueled fears in Afghanistan that the U.S.

commitment was fading in the almost nine-year-old war.