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.

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.

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.

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.

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."

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.

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.----