THE U.S. MISSION in Afghanistan has suffered daunting setbacks in recent months, including attacks by Afghan soldiers on U.S. troops, the massacre of 17 Afghan civilians, allegedly by an Army sergeant, and the mistaken burning of Korans on an American base. So the breakthrough announced on Sunday was particularly significant: U.S. and Afghan officials initialed a strategic partnership agreement that would commit the United States to supporting Afghanistan for a decade beyond the scheduled withdrawal of combat troops at the end of 2014.

Under negotiation for two years, the deal has not been finalized — it must still get the sign-offs of the White House, the Afghan parliament and President Hamid Karzai — and it lacks some critical content, to which we’ll return. But President Obama and his ambassador in Kabul, Ryan C. Crocker, deserve credit for continuing to pursue the agreement in spite of the recent reverses and election-year pressures to abandon Afghanistan. Mr. Crocker’s diplomacy helped to overcome disagreement over how to handle detainees and conduct night raids by Special Forces — in both cases by granting more control to the Afghan government and its forces.

The deal offers a path toward long-term success in the war: not just the withdrawal of U.S. and NATO troops, but also the preservation of an Afghan government that resists Islamic extremism, protects fundamental rights and is able to defend itself. The simple assurance of continued U.S. military and economic engagement could discourage leaders of the Taliban and their supporters in Pakistan from a strategy of waiting out the NATO troop withdrawal. By the same token, Afghans, with more confidence that their government will survive, will have reason to remain in the country, invest and participate in the elections that will choose a successor to Mr. Karzai by the end of 2014.

Assuming the deal wins approval in time for a NATO summit in Chicago next month, the challenge will be to inject content into what is now a broad outline. One critical area will be NATO’s support for Afghan security forces: As it is, NATO has decided to scale back the Afghan army and police from a peak strength of 350,000 later this year to 230,000 — a risky reduction based on cost rather than threat assessment. Even that force will depend on funding from NATO members that has yet to be firmly committed. The U.S. quota, at just over $2 billion, is a fraction of the more than $100 billion recent annual tab for the war, but the histories of Afghanistan and Vietnam show that congressional support can be fickle.

Afghanistan will also need long-term NATO air support — it has none of its own — as well as trainers and special forces capable of targeting al-Qaeda and responding to emergencies. A force far smaller than the current one of 90,000 Americans would be sufficient. But the administration cannot afford to repeat its handling of Iraq, where it cut down a proposed residual force to insignificant size before failing to agree on it with the Iraqi government.

Whatever its dimensions, a continued U.S. commitment to Afghanistan will be controversial. That’s why the most important follow-up to the new agreement must come from Mr. Obama. The president has not given a major speech about Afghanistan in more than a year and has not visited the country in 18 months. His actions will be important to reinforce the message, to both Afghans and Americans, of the bilateral accord: that he is firmly committed to Afghanistan’s future.