BAGHDAD, Iraq, June 26 — On a recent afternoon in his new office in the heavily fortified Green Zone, Lt. Gen. David H. Petraeus, a celebrated American field commander, sketched his vision for how America's forces might one day extract themselves from this country.
"I know where this ends," said General Petraeus, 51, who earlier this month took control of a vast project to oversee the training of Iraqi security forces. "It ends with the Iraqis in charge of their country. You get as many Iraqis as possible to have a stake in the success of the new Iraq to defeat the insurgency."
Just a few hundred yards from his office, the magnitude of his challenge loomed in the form of Zhuhair Khamis, an Iraqi Civil Defense officer standing guard at the entrance to the American compound.
"I am not ready to fight Iraqis," said Mr. Khamis, a 33-year-old Iraqi Shiite. "I will throw down my weapon, I will throw down my uniform, and I will give back my badge. I will fight foreigners; but I am not ready to fight Iraqis."
General Petraeus, who scored some of the Army's most notable successes in the previous year here, is now charged with perhaps the most ambitious project that will unfold in the year that begins with the restoration of Iraqi sovereignty on Wednesday: rebuilding an Iraqi security force that collapsed during April's uprisings, when Iraqi soldiers quit and ran rather than fight their own people. The insurgency is still boiling: on Saturday, a group led by the Jordanian militant Abu Musab al-Zarqawi claimed it had kidnapped three Turks in Iraq and threatened to behead them, and a bomb killed as many as 40 people in Hilla, south of Baghdad.
General Petraeus's goal, in his own words, is to help create an Iraqi Army that will have the discipline and the heart to defeat the insurgency on its own, and ultimately enable American forces to go home, and could jeopardize Iraq's ability to hold elections.
Anything less will probably condemn the Americans to a bloody, long-term intervention here, or to a withdrawal that could send Iraq spinning off into chaos.
In a war that seems more like a quagmire every day, General Petraeus says he can see the shape of victory — he just cannot predict when he will get there. "I can't predict," he said. "It's not going to be someone flipping a light switch."
Last year, as the head of the elite 101st Airborne Division, General Petraeus's efforts in the northern Iraqi city of Mosul constituted one of the few bright spots in an otherwise troubled occupation.
For General Petraeus, the new job presents an enormous risk, one that could make or break an already impressive military career. The task — creating a credible army in a foreign country under siege — seems likely to require skills that American generals are not ordinarily known for, like offering advice that might be ignored, or standing on the sidelines while Iraqis step to the fore.
The magnitude of the task that confronts General Petraeus was made clear two months ago, when revolts in Falluja and in cities across southern Iraq led to the widespread collapse of the 200,000-man, American-trained Iraqi security forces.
The uprisings were eventually brought under control, but the Iraqi forces hardly played a role. In Baghdad, half of the Iraqi Civil Defense Corps, a national militia trained by the Americans, either quit or sided with the insurgents; in Karbala, the corps disintegrated entirely. In Falluja, when American commanders ordered Iraqi soldiers into battle, they mutinied, with some 200 armed Iraqis refusing to board American helicopters.
Maj. Gen. Paul Eaton, who oversaw the training of Iraqi forces until General Petraeus took over earlier this month, said the Americans tried to do much too fast, and missed the degree to which the country's various ethnicities and religious groups had failed to jell into a coherent nation.
"In America, we have this national ethos; you identify with the Pledge of Allegiance and the flag, the stars and stripes," General Eaton said. "In Iraq, that is overshadowed by tribe, imam, family and ethnicity. I talked to countless young soldiers who said, `My name is Muhammad, and I am a Turkoman' or `I am a Sunni' or `I am a Shiite.' "
General Petraeus acknowledges the obstacles but believes he can transcend them. A 1974 graduate of West Point, he is a veteran of operations in Haiti and Bosnia, but not in a combat zone until he came to Iraq last year.
He has a doctorate in international relations from Princeton University, where he wrote his dissertation on the lessons of the Vietnam War.
As a young battalion commander, General Petraeus survived a gunshot wound to the chest, and later shattered his pelvis during a parachute jump.
For all of that, General Petraeus is a fanatical devotee of physical fitness; the general can demolish 19-year-old recruits in pushup contests, and two years ago, at the age of 49, completed a 10-mile run in less than 64 minutes.
"Do you think you can outrun me?" General Petraeus said, challenging an Iraqi soldier at the Taji training base north of Baghdad the other day.
Even before General Petraeus arrived, American commanders had already begun a vast overhaul of the Iraqi security services, based on the experience of the April uprisings. With the new Iraqi leadership, they have taken the country's most important internal security unit, the civil defense corps, and begun turning it into a branch of a revamped 100,000-man Iraqi Army.
The locally recruited corps officers will be taken out of their homes and cities, away from their families and tribes and mosques, and turned into regular soldiers who live on bases and train and fight together. To make that happen, the Americans have committed $3 billion to building training sites and regional headquarters and to better equip Iraqi soldiers.
It will be up to General Petraeus to carry out these changes, and he says he plans to carry them out in much the way he did in northern Iraq, where he commanded American forces until earlier this year.
For nearly a year, General Petraeus reigned as a kind of benevolent dictator in the city of Mosul, presiding over an array of projects that transformed the region. He hired and fired local leaders. He conducted combat operations. He decided which former members of the Baath Party could stay, and which would go.
In nearly a year in Mosul, General Petraeus's 101st Airborne Division carried out some 5,000 reconstruction projects worth an estimated $57 million.
In addition to refurbishing schools and irrigation networks, the general created a youth soccer league with 150 teams, appeared on a call-in radio show and even set up a television network, Mosul Television, known around town as MTV.
The biggest TV hit: "Iraqi Idol," a talent search program modeled after its American counterpart.
"A wild success," General Petraeus said.
He said his philosophy in Mosul was not to dictate to the Iraqis or give them handouts, but to help them do the jobs themselves. It is the same philosophy, he said, that will guide him in his mission to train the new Iraqi Army.
"What we are going to do now is nothing new," General Petraeus said. "We are enabling, supporting and assisting Iraqis. We made a lot of friends there."
For all the general's efforts, the Mosul experiment began to sour last autumn, when the security situation sharply deteriorated. A number of Iraqis cooperating with the American-backed government have been killed there in recent months.
Mosul's experience is similar to that of many other cities around central Iraq, where millions of dollars spent on projects ultimately failed to quell the insurgency.
To set up an effective Iraqi Army, General Petraeus believes that the most important change is already happening — putting Iraqis in charge of the army and the government.
Part of the problem last April, he acknowledged, was not just that Iraqi soldiers were refusing to fight other Iraqis, it was that the people who were ordering them to do so were Americans.
To that end, the Americans have installed a veteran Iraqi general, with a history of independence from Saddam Hussein, as the army chief of staff. Already, that general, Amir Hashemi, said he had found the America training of Iraqi troops to be woefully inadequate.
"I am not satisfied with the training provided by the Americans," General Hashemi said. "We must do this the Iraqi way."
General Petraeus says he is cheered by that kind of independence, since it is the Iraqis, ultimately, who will have to do the fighting.
Yet at the same time, General Petraeus is trying to impart Western notions on the armed forces here, particularly the idea that the army, and the Iraqi nation, must transcend loyalties to tribe and religion.
"This is your new tribe," he said to an Iraqi soldier, an ethnic Kurd, who stood in line as General Petraeus inspected the troops.
"These are all your new brothers," he said to another.
Yet for all the talk of encouraging the Iraqis to go their own way, General Petraeus has on occasion found it difficult to forget that he is after all an American general, whose every order is obeyed and whose very presence commands immediate respect.
On those occasions, the Iraqis have usually been happy to remind General Petraeus that, come June 30, Iraq will be their country again.
On recent visit to a police station in the southern Iraqi town of Hilla, General Petraeus strode in and offered his hand to the police chief there, Gen. Qais Mamoonia.
"Welcome to Hilla," General Mamoonia said to General Petraeus.
"Thank you, general, but I have actually been here before," General Petraeus said. "In April last year I came. We liberated Hilla."
General Qais paused for a long time, looking up at the ceiling.
"Welcome again, then," he said.
There was laughter all around, and the two men got down to work.