A US soldier in Afghanistan has shot dead 16 civilians and wounded others after entering their homes in Kandahar province, Afghan and Nato sources say.
He reportedly left his base early in the morning to attack village homes. Nine children are among the dead.
The White House voiced "deep concern" and Nato-led forces in Afghanistan promised a rapid inquiry.
Afghan President Hamid Karzai has condemned the attack and demanded an explanation from Washington.
BBC correspondents say there could be a furious backlash when news of the attack reaches the wider public.
In Kandahar's Panjwai district, local people have gathered near the base to protest about Sunday's killings, and the US embassy is advising against travel to the area.
Anti-US sentiment is already high in Afghanistan after US soldiers burnt copies of the Koran last month.
US officials have apologised repeatedly for the incident at a Nato base in Kabul but they failed to quell a series of protests and attacks that killed at least 30 people and six US troops.
'Shot and burnt'
The unnamed soldier, thought to be a staff sergeant, is reported to have walked off his base at around 03:00 local time (22:30 GMT Saturday).
He then made his way to the villages of Alkozai and Najeeban, about 500m (yds) from the base.
A local resident, Abdul Baqi, told the Associated Press news agency the soldier had apparently opened fire in three different houses.
"When it was happening in the middle of the night, we were inside our houses," he said. "I heard gunshots and then silence and then gunshots again."
In one house in Najeeban, the gunman reportedly killed 11 people, setting fire to their bodies before he left.
A relative of the 11 victims, Haji Samad, told Reuters news agency chemicals had been poured over the bodies and set alight.
"I saw that all 11 of my relatives were killed, including my children and grandchildren," he added, weeping.
An unnamed woman witness in Najeeban told BBC News she had heard gunfire at about 02:00. A barking dog was shot dead by the gunman, she said.
She added that the Taliban had not been seen in the area for five months.
At least three of the child victims were killed by a single shot to the head, the BBC's Quentin Sommerville reports from Kabul.
Photographs from the scene showed bodies, some of them clearly young children, placed in a vehicle under blankets.
Five wounded Afghans were taken to Nato medical facilities, the Associated Press reports.
Some sources suggested that more than one soldier was involved in the attack, and a statement by the Taliban accused Afghan security forces of playing a role.
A delegation from the provincial governor's office has arrived in the village to determine exactly what happened, a spokesman said.
The soldier - who reportedly suffered a breakdown before the attacks - is said to have handed himself over to the US military authorities after carrying out the killings.
In a statement, Mr Karzai described the deaths in Kandahar as "intentional murders".
"When Afghan people are killed deliberately by US forces this action is murder and terror and an unforgivable action," he said.
President Karzai has been consulting officials in Kandahar by telephone.
US President Barack Obama called Mr Karzai "to express his shock and sadness" and extend his condolences to the Afghan people, the White House said.
"This incident is tragic and shocking, and does not represent the exceptional character of our military and the respect that the United States has for the people of Afghanistan," Mr Obama said.
Gen John R Allen, commander of the Nato-led International Security Assistance Force (Isaf), said US officials in Afghanistan would work with their Afghan counterparts to investigate what had happened.
"I pledge to all the noble people of Afghanistan my commitment to a rapid and thorough investigation," he saidin a statement.
"This deeply appalling incident in no way represents the values of Isaf and coalition troops or the abiding respect we feel for the Afghan people."
This is the first time Afghan civilians have been targeted by foreign soldiers in this way, our Kabul correspondent says.
However, a US soldier was convicted last year on three counts of premeditated murder after leading a rogue "kill team" in Afghanistan.
Kandahar is the Taliban's spiritual heartland and is considered strategically important because of its international airport, its agricultural and industrial output and its position as one of the country's main trading hubs.
The province has seen heavy fighting between Nato and Taliban forces over the last five years.
Mr Karzai said earlier he still expected to sign a strategic partnership with the US in the next couple of months.
He said discussions would continue on the precise role the US would play in Afghanistan after Nato handed over security responsibility to Kabul at the end of 2014.
On Friday, Kabul and Washington reached a deal to transfer US-run prisons in the country to Afghan control.