Afghans "have run out of patience" with foreign troops, the country's MPs have warned, after a US soldier killed 16 Afghan civilians.

The strongly worded resolution came as US officials issued an alert, fearing reprisals after the Kandahar rampage. Nine children were among those killed.

Afghan President Hamid Karzai said the act was "unforgivable". Taliban militants have vowed revenge.

The soldier is being questioned, and Nato has promised to deliver justice.

This is an assassination... and cannot be forgiven Hamid Karzai, Afghan President Mardell: Hammer blow

The killings could further fuel calls for a more rapid withdrawal of US troops from Afghanistan.

Anti-US sentiment is already high after soldiers burned some copies of the Koran at a Nato base in Kabul last month.

US officials have repeatedly apologised for the Koran incident, which sparked a series of protests and attacks that killed at least 30 people and six US troops.

Ties tested

The soldier, believed to be a staff sergeant, left his base in Kandahar in the early hours of Sunday.

Locals say he broke into three homes. Eleven people were shot dead at one house in the village of Najeeban, and some of their bodies had been set alight.

At least three of the child victims are reported to have been killed by a single shot to the head.

Analysis Even as the shock at the killings sinks in, there has been no repeat of earlier protests. Village elders say the streets will remain quiet as long as the gunman is brought to justice. But still there is anger among locals. US President Barack Obama was shocked and saddened at the killings, which he said were not representative of US military forces. In a call to President Karzai he promised a full investigation. This will not affect the mission in Afghanistan, the US insists. But in Kabul others are more sceptical. Many are already talking about the long-term damage to US-Afghan relations. Across Afghanistan, people are asking why a soldier sent to protect them would commit such a bloody crime.

The soldier returned to his base after the shootings and apparently turned himself in to military authorities.

His motives are unclear, but there is speculation that he might have been drunk or had suffered a mental breakdown. Officers are worried that the attack might have been planned.

The detained soldier has not been identified, but the Associated Press news agency quoted US officials as saying he was from Joint Base Lewis-McChord in Washington state, 38 years old and married with two children.

The AP reports said he had served three tours in Iraq and was on his first deployment in Afghanistan.

"This is an assassination, an intentional killing of innocent civilians and cannot be forgiven,'' Mr Karzai said in a statement.

US President Barack Obama phoned Mr Karzai on Sunday to express condolences over the "tragic and shocking" incident.

'Public trial'

In its resolution, the lower house of the Afghan parliament said Afghans had "run out of patience with the arbitrary actions of foreign forces".

"We seriously demand and expect that the government of the United States punish the culprits and try them in a public trial before the people of Afghanistan."

Previous tension points February 2012: Deadly protests after US troops inadvertently burn Koran

Deadly protests after US troops inadvertently burn Koran January 2012: Video shows US marines urinating on dead Afghans

Video shows US marines urinating on dead Afghans March 2011: Radical US pastor burns Koran, triggering deadly protests

Radical US pastor burns Koran, triggering deadly protests April 2008:Protests against cartoon of Prophet Muhammad in Danish newspapers Is killing civilians inevitable in war?

The call came despite an Afghan agreement with Nato for foreign soldiers to be tried in their own countries.

The BBC's Bilal Sarwary in Kabul says the incident has damaged already fragile relations between Kabul and Washington.

The Taliban is using the shooting as a propaganda victory, placing Mr Karzai in a difficult position, he says.

Angry tribal elders are now demanding an immediate end to US night raids on Afghan homes.

Meanwhile, US personnel in Afghanistan werewarned of possible reprisal attacks.

Afghan officials fear there will be violent demonstrations and have deployed extra police and troops around Kandahar.

However, a local elder told the BBC there would be no protests, as long as the soldier was put on trial.

Sources close to Mr Karzai say the murders will complicate negotiations on a strategic agreement between the two countries that could keep US troops in the country beyond 2014.

A recent poll by ABC News and the Washington Post found 60% of Americans believe the war in Afghanistan is not worth its costs. Nearly the same number advocated an early US pullout from the country.