TALLINN, Estonia (AP) — Fearful of losing public support for the war in Afghanistan, the U.S. and NATO on Friday agreed to start transferring control of the country back to its leaders by year's end but acknowledged that achieving stability will take decades.

If successful, the transition plan approved by U.S. Secretary of State Hillary Rodham Clinton and representatives of the 27 other NATO countries would enable President Barack Obama to meet his target date of July 2011 for starting to bring American troops home.

The stakes are high. If the plan fails, public support in Europe, the U.S. and among Afghans themselves could further erode or even collapse.

Much depends not only on improved NATO military performance but also on political reconciliation between the Taliban and Afghan's central government. The allies must quickly improve the training and performance of the Afghan army and police, and strengthen Afghan institutions weakened by decades of conflict.

Clinton on Friday offered an optimistic assessment of the approach, which NATO hopes Afghan President Hamid Karzai will endorse in July at an international conference in Kabul.

Once approved, NATO would officially implement the plan at a summit, possibly in conjunction with a public announcement of the first provinces to be transferred to Afghan control, said Mark Sedwill, the senior NATO civilian in Kabul.

"We believe that with sufficient attention, training and mentoring, the Afghans themselves are perfectly capable of defending themselves against insurgents," Clinton told a news conference. "Does that mean it will be smooth sailing? I don't think so. Look at Iraq."

Asked whether any plan to turn power over to Afghanistan's sometimes dysfunctional, corrupt and resource-poor government was viable, Sedwill told reporters; "It's far from certain."

Yet he and other NATO officials said they believe that with an infusion of new military and civilian aid — including the 30,000 U.S. troops dispatched by the Obama administration last December — success is possible.

"Increasingly this year the momentum will be ours," said NATO Secretary General Anders Fogh Rasmussen. He said the transition to Afghan control is important to demonstrate not only to Afghans but also to the Western countries fighting there that an end to the war is in sight.

"Our aims in 2010 are clear: to take the initiative against the insurgents, to help the Afghan government exercise its sovereignty, and to start handing over responsibility for Afghanistan to the Afghans this year," Fogh Rasmussen said. He added, however, that even if the transition unfolds as expected it will takes decades of additional assistance for Afghanistan to stand on its own.

Sedwill said the first provinces to be transferred to government control would likely be in the north and west, where the Taliban is less active. And he said the idea is to hand over a cluster of contiguous provinces at the same time to increase the odds of their withstanding the insurgents.

Clinton warned of a hard road ahead, but said she was not discouraged by the obstacles.

NATO is about 450 trainers short of the number it says are needed to prepare security forces for transition to an Afghan-run Afghanistan. That gap apparently remained after Friday's session, which was not designed to elicit specific pledges of troops, trainers or other military resources.

"We have a relatively small gap that we're still working to fill. I'm very convinced we'll get that filled," Clinton said, adding: "For me, the glass is way more than half full."

Rasmussen stressed the importance of providing hope to Afghan civilians and halting an erosion of public support for the war in NATO countries.

"Citizens in Afghanistan and in all troop contributing countries are demanding visible progress, and they are right to insist on that," he added. "We should have no illusions. Making progress will not be easy and will not be quick. But based on what we see on the ground now, it is happening."

He added that winding down the war does not mean the allies will leave before the mission is accomplished.

"It will not be a run for the exits," he said.

To underscore NATO's effort to coordinate of its strategy and operations with the government in Kabul, Afghan Foreign Minister Zalmai Rassoul attended the Tallinn meeting.

The participants were briefed via video conference by U.S. Gen. Stanley McChrystal, Afghanistan's top NATO commander, and in person by Adm. James Stavridis, the top NATO commander in Europe, as well as by Sedwill and other top civilian officials.

In a speech Thursday before the two-day NATO meeting began, Fogh Rasmussen called Afghanistan the most challenging military operation in NATO's history.

"We all want to see a stable and secure Afghanistan — an Afghanistan that is no longer a threat to its region and to the rest of the world," he said. "We will stay in Afghanistan as long as it takes to achieve that goal. We want to continue to empower the Afghans. And gradually hand over to them greater responsibility for the security of their own country when conditions permit."