President Barack Obama promised a speedy investigation into the "shocking" killing of 16 Afghans by a rogue US soldier, which fuelled tensions after the burning of Korans at a US-run base.
Obama telephoned Afghan President Hamid Karzai to convey his condolences after the soldier gunned down civilians, including women and children, in their homes in a pre-dawn rampage in the southern province of Kandahar.
The US embassy in Kabul sent out an alert to its citizens in Afghanistan warning that as a result of the shooting, "there is a risk of anti-American feelings and protests in coming days".
Relations plunged to an all-time low last month after the burning of Korans at an American-run military base sparked days of anti-US protests, which left some 40 people dead and prompted an apology from Obama.
Sunday's massacre poses an acute new test of the US-Afghan alliance, as the two countries pursue difficult talks on securing a strategic pact to govern their partnership once foreign combat troops leave Afghanistan in 2014.
Obama described the massacre as "tragic and shocking", the White House said, and assured Karzai of Washington's "commitment to establish the facts as quickly as possible and to hold fully accountable anyone responsible".
In an angry statement after the Kandahar shootings, Karzai said that "when Afghan people are killed deliberately by US forces, this action is murder and terror and an unforgivable action".
Kandahar province is a stronghold of Taliban insurgents fighting to oust Karzai's government, which is supported by some 130,000 US-led NATO troops.
US Defense Secretary Leon Panetta also called Karzai and assured him that a "full investigation" was under way. In Brussels, NATO chief Anders Fogh Rasmussen expressed shock and offered his "heartfelt condolences".
Australia, which has about 1,550 soldiers in Afghanistan, also offered condolences but vowed to stay focused on the mission.
"Of course, an incident like this is a truly distressing one but it is not going to distract us from our purpose in Afghanistan. We know what we're there to do," Prime Minister Julia Gillard said.
In Sunday's shooting, the US soldier entered the homes of villagers in Kandahar province's Panjwayi district and killed 16 people including nine children and three women, according to a statement from Karzai.
It quoted a wounded 16-year-old, who was shot in the leg, as telling Karzai by phone that the soldier entered their home in the dark before dawn, woke up his family members and then shot them.
An AFP reporter at the scene of the killings counted the bodies of 16 people, including women and children.
In one house, he saw 10 people killed and burned in one room. Another woman was lying dead at the entrance of the house and there were at least two children just two or three years old among the dead.
In one house, an elderly woman screamed: "May God kill the only son of Karzai, so he feels what we feel."
Western sources said the rampage began after the soldier walked off his base in the early hours of Sunday morning, apparently heavily armed and carrying night-vision equipment.
He was arrested outside the base by members of the Afghan National Army, the army corps commander in southern Afghanistan, Abdul Hameed, told AFP.
Deteriorating US-Afghan relations risk complicating the track towards the scheduled end of US-led foreign combat operations in 2014.
The proposed strategic pact would likely cover the legal status of any US troops remaining in Afghanistan to help Kabul with intelligence, air power and logistics in the fight against Taliban insurgents.
Negotiations over the pact received a boost last week when Washington signed a deal on Friday transferring to Kabul control of the controversial Bagram prison -- the site of last month's Koran burning.
In Iraq, Washington abandoned its pursuit of a strategic partnership deal and pulled out all its combat troops, leaving no residual force, after failing to get Baghdad to grant its soldiers legal immunity.
Afghan resentment of US forces has also been exacerbated by a video posted online in January showing US Marines urinating on the bloodied corpses of slain Afghan insurgents -- an incident condemned by the Pentagon.
In November, the ringleader of a rogue American military "kill team" charged with murder for shooting civilians for sport was found guilty and sentenced to life in prison by a military panel.