KABUL — With the signing of the “strategic partnership agreement” Tuesday during a surprise visit by President Obama, the United States entered perhaps the most complicated phase of its decade-long war in Afghanistan — a chapter that will include both the ongoing withdrawal of U.S. troops and a more precise articulation of the United States’ long-term presence here.

The accord signed by Obama and Afghan President Hamid Karzai pledges American financial and military support beyond 2014, when the U.S. combat mission will formally conclude. But that broad outline must now be filled in with details of the U.S. commitment — troop levels, counterterrorism operations and economic assistance — informed by strategic concerns on the ground and the political calculus in war-weary Washington.

U.S. and Afghan officials have given themselves one year to craft a status-of-forces agreement that will answer lingering questions about the nature of the long-term military partnership. Ambassador Ryan C. Crocker suggested Wednesday that the agreement signed in Iraq could be seen as a guideline. But Afghan leaders are far more eager than were Iraqis to maintain a strong American presence in their country after the war’s conclusion, raising concerns about both resources and willingness during the waning days of the United States’ longest war.

U.S. officials have said that they will not keep long-term bases in Afghanistan and that the country will not be used as a staging ground for attacks on Pakistan. But Crocker said Wednesday that “if we or Afghanistan are threatened or attacked by countries outside of Afghanistan, we have the right of self-defense.”

Despite the unknowns ahead, Afghan and U.S. officials on Wednesday celebrated the signing of the agreement, calling it a historic bilateral commitment. “It is a new beginning in the U.S.-Afghan relationship,” said Shaida Abdali, the deputy national security adviser.

For his part, Karzai was quick to remind top Afghan leaders that the autonomy written into the partnership agreement and the memorandums that preceded it will permit Afghans to be more discerning when it comes to following U.S. directives.

“If you have any doubt about an American intelligence report, do not conduct any operation based on it,” he told officials Wednesday at the Interior Ministry.

The comment served as a reminder that Karzai’s vision of a sovereign Afghanistan could well include assertions of independence that challenge NATO’s military strategy. After signing a memorandum last month, his government assumed control over controversial night operations, long considered a central part of NATO’s war effort. In September, the Afghans will take over the sole U.S. military prison here, including the country’s highest-profile detainees.

Those handovers are symbols of progress when seen in the context of bolstering Afghan authority and the power of the country’s institutions, U.S. officials say. But they also mark the first time in the war that Afghans will be able to halt potentially valuable military operations and release detainees at will. U.S. officials have expressed concern about both prospects, but they say such challenges are inherent in the transition process.

The biggest threat to the war effort and to U.S.-Afghan relations, however, remains the level of violence, which has surged in recent weeks, as it typically does in the spring. On Wednesday morning, just hours after Obama left Kabul, attackers stormed a fortified compound on the edge of the capital where hundreds of Western contractors and aid workers live, killing seven civilians and wounding more than a dozen, according to Afghan security officials. The Taliban quickly asserted responsibility for the attack.

“As soon as our mujaheddin fighters heard about Obama’s trip, they organized the attack, and this was the nearest target for them. This is a clear message to Obama not to think about permanent bases in Afghanistan,” said Zabiullah Mujahid, a Taliban spokesman.

In another statement, the Taliban asserted that the strategic partnership “gave legitimacy to the occupation of Afghanistan and will lead to further insecurity and political instability.”

The attackers sped toward the compound and detonated a car bomb, allowing three other assailants disguised in burqas and armed with rifles and hand grenades to breach the compound’s perimeter, said Gen. Abdul Zahir, head of the Kabul police criminal investigation division.

Afghan security forces killed the last attacker several hours into the standoff. The assault occurred just across the street from a school; one child was killed, and several were wounded.

“This is another desperate attack by the Taliban, but again, another noteworthy performance by Afghan Security Forces for taking the lead in putting down another desperate attack by insurgents,” said German Brig. Gen. Carsten Jacobson, a spokesman for NATO forces.

Comments our editors find particularly useful or relevant are displayed in Top Comments, as are comments by users with these badges: . Replies to those posts appear here, as well as posts by staff writers.

To pause and restart automatic updates, click "Live" or "Paused". If paused, you'll be notified of the number of additional comments that have come in.

Comments our editors find particularly useful or relevant are displayed in Top Comments, as are comments by users with these badges: . Replies to those posts appear here, as well as posts by staff writers.

Spam

Offensive

Disagree

Off-Topic

Among the criteria for featured comments: likes by users, replies by users, previous history of valuable commenting, and selection by moderators.

Content from Allstate This content is paid for by an advertiser and published by WP BrandStudio. The Washington Post newsroom was not involved in the creation of this content. Learn more about WP BrandStudio.