The massacre of 16 villagers by a U.S. soldier has triggered angry calls for an immediate American exit from Afghanistan as Washington tries to negotiate a long-term presence to keep the country from sliding into chaos again.
Just days before Sunday's attack, Kabul and Washington had made significant progress in negotiations on a Strategic Partnership Agreement that would allow American advisers and special forces to stay in Afghanistan after foreign combat troops leave at the end of 2014.
But securing a full deal may be far more difficult now after the shooting spree in villages in the southern province of Kandahar, the Taliban heartland, which killed mostly women and children.
This could delay the signing of the Strategic Partnership Agreement, an Afghan government official told Reuters.
The attack, the latest American public relations disaster in Afghanistan, may be a turning point for the United States in a costly and unpopular war now in its eleventh year.
Afghanistan's parliament condemned the killings, saying Afghans had run out of patience with the actions of foreign forces and the lack of oversight.
Popular fury over the killing spree, which brought demands that the United States withdraw earlier than scheduled, could be exploited by the Taliban to gain new recruits.
We have benefited little from the foreign troops here but lost everything - our lives, dignity and our country to them, said Haji Najiq, a Kandahar shop owner.
The explanation or apologies will not bring back the dead. It is better for them to leave us alone and let us live in peace.
Anti-Americanism, which boiled over after copies of the Muslim holy book, the Koran, were inadvertently burned at a NATO base last month is likely to deepen after the Kandahar carnage.
The Americans said they will leave in 2014. They should leave now so we can live in peace, said Mohammad Fahim, 19, a university student. Even if the Taliban return to power our elders can work things out with them. The Americans are disrespectful.
The civilian deaths may also force Afghan President Hamid Karzai to harden his stand in the partnership talks to appease a public already critical of his government's performance.
The partnership agreement, which Washington and Kabul have been discussing for more than a year, will be the framework for U.S. involvement in Afghanistan after foreign combat troops leave at the end of 2014.
Without a pact that keeps U.S. advisors or special forces here, there is a danger that civil war could erupt again in Afghanistan because ill-trained Afghan forces would be unable to keep insurgents at bay.
The Kandahar violence came just days after the United States and Afghanistan signed a deal on the gradual transfer of a major U.S.-run detention centre to Afghan authorities, overcoming one of the main sticking points in the partnership negotiations.
The Americans are not here to assist us they are here to kill us, said Najibullah, 33, a house painter in Kabul.
I hate the Americans and I hate anyone who loves them, so I hope there is no long-term partnership between our countries.
Afghanistan wants a timeline to take over detention centres and for the United States and NATO to agree to end night raids on Afghan homes as preconditions for signing the pact.
Civilian deaths are one of the main sources of tension between Kabul and Washington.
U.S. officials warned of possible reprisal attacks after the villagers were killed in the likely rogue shooting.
Washington has rushed to distance the shootings from the efforts of the 90,000-strong U.S. force but faces growing criticism at home and abroad about its conduct of the war.
The U.S. Embassy in Kabul alerts U.S. citizens in Afghanistan that as a result of a tragic shooting incident in Kandahar province involving a U.S. service member, there is a risk of anti-American feelings and protests in coming days, especially in the eastern and southern provinces, the embassy said in an emergency statement on its website.
Kandahar is the birthplace of the Taliban, who were toppled by U.S.-backed Afghan forces in late 2001. Southern and eastern provinces have seen some of the fiercest fighting of the war.
The U.S. embassy said on its Twitter feed that restrictions had been placed on the movements of its personnel in the south.
A sharp increase in attacks on U.S. troops by Afghan forces followed the Koran burning. Sunday's incident in Kandahar was one of the worst of its kind, witnesses describing it as a night-time massacre that killed nine children and three women.
Villagers in three houses were attacked and many civilians were wounded, a spokesman for the NATO-led International Security Assistance Force (ISAF) said.
U.S. President Barack Obama called Karzai, promising a quick investigation and to hold accountable anyone responsible for an incident he called tragic and shocking.
But Afghans are tired of American apologies. Such incidents are often quickly exploited by insurgents and the Afghan Taliban said it would take revenge.
The Kandahar shootings will give the Taliban the chance to prove to Afghans that they are the freedom fighters and the Americans are the evil ones, said Waheed Mujhda of the Afghan Analysts Network.
Sunday's attack may also harden a growing consensus in Washington about what can be accomplished in Afghanistan.
The bill for the war has already exceeded $500 billion and more than 1,900 U.S. troops have been killed, with the total number of foreign troops killed approaching 3,000.
These killings only serve to reinforce the mindset that the whole war is broken and that there's little we can do about it beyond trying to cut our losses and leave, said Joshua Foust, a security expert with the American Security Project.
Karzai, whose relationship with his Western backers is fraught at the best of times, condemned the rampage as intentional murders and demanded an explanation. Karzai's office released a statement quoting a villager as saying American soldiers woke my family up and shot them in the face.
There were conflicting accounts of how many U.S. soldiers were involved, with witness accounts saying there were several.
Officials from the U.S. embassy, ISAF and from Washington said it appeared there was only one. An ISAF spokesman said the lone U.S. soldier walked back to the base and turned himself in to U.S. forces this morning.
The detained soldier was described by U.S. officials as a staff sergeant who was married with three children. He had served three Iraq tours but was on his first Afghan deployment.
(Additional reporting by Hamid Shalizi and Mirwais Harooni in KABUL, and Missy Ryan and Alister Bull in WASHINGTON; Writing by Michael Georgy; Editing by John Chalmers and Sanjeev Miglani)