Image caption Most US forces are due to leave Afghanistan by 2014

US President Barack Obama has promised that international forces will not "rush for the exits" in Afghanistan, after an American soldier was accused of murdering 16 civilians.

Mr Obama said foreign troops must be withdrawn in a responsible way.

The killings in Kandahar province have strained relations between Afghans and foreign forces.

US Defence Secretary Leon Panetta says the suspect could face the death penalty, if found guilty.

Mr Panetta said that the intention was to try the case in a US military court.

Asked whether the soldier, who gave himself up, had confessed to the alleged crimes, the US defence secretary said: "I suspect that that was the case."

On Tuesday morning, some 600 students took part in a rally in the eastern city of Jalalabad, condemning the attack and chanting "Death to America! Death to Obama!".

There are also reports of protesters gathering in Kandahar.

The Taliban has renewed threats of revenge attacks, saying it would behead "sadistic" American soldiers.

'More determined'

Mr Obamatold local CBS station KDKAon Monday that the shooting was "absolutely heartbreaking and tragic".

Analysis Aides of Hamid Karzai admit this incident has put him in a very difficult position - in addition to being president he is a tribal elder in Kandahar and must explain the killings to the families. Although Afghans both inside and outside the government would prefer a public trial in Afghanistan for the American soldier, officials accept that Kabul has signed an agreement with Washington and other Nato member states under which soldiers are tried in their home countries. In that case, one presidential aide said, Afghanistan would push for a US trial "in open court, in the presence of the media in weeks or months, but not years". If guilty Kabul would demand the death penalty. It also wants those in charge at the base to be held responsible for not preventing the soldier's attack.

When asked if the incident had made him think that the troop withdrawal should be quickened up, he said: "It makes me more determined to make sure we're getting our troops home."

He added: "What we don't want to do is to do it in a way that is just a rush for the exits."

Mr Obama said that international forces had to make sure the Afghans could secure their borders and stop al-Qaeda from getting back into the country.

Afghan MPs passed a motion earlier saying Afghans had run out of patience.

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

Details about the shootings are still unclear, but the American soldier left his base in the southern province of Kandahar in the early hours of Sunday and went on a rampage in nearby villages.

Locals told reporters how they cowered in fear as the man made his way from door to door, trying to get into their houses.

"I saw a man, he dragged a woman by her hair and banged her head repeatedly against the wall. She didn't say a word," one witness said.

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

He broke into three houses and killed 16 people, most of them women and children. He then burned their bodies, according to reports.

The US defence secretary gave this account of events:

"He went out in the early morning and went to these homes and fired on these families. And then at some point after that, came back to the forward operating base and basically turned himself in, told individuals what had happened."

Pentagon officials said they would not release his name while the investigation was going on.

Reports said the soldier was in his 30s with three children.

He had been deployed to Afghanistan in December for his first tour of duty there after serving three times in Iraq.