Formal charges of murder and attempted murder have been laid against a US soldier, Staff Sergeant Robert Bales, who is accused of killing civilians in Afghanistan.

17 Afghan villagers, including nine children, died in a shooting attack in Kandahar province earlier this month.

Sergeant Bales, 38, is being held at a maximum security military prison in Kansas, and faces the death penalty if found guilty.

“The charges allege that, on or about 11 March, 2012, Staff Sergeant Bales did, with premeditation, murder 17 Afghan civilians and assaulted and attempted to murder six other civilians," a US armed forces statement said.

Initial reports from Afghanistan put the death toll at 16 people. However, a US official said the death toll now included four men, four women and nine children. One man, one woman and four children were wounded.

It was not immediately clear where the extra count came from, as Afghan officials were today still counting 16 dead.

The killings seriously strained relations between Kabul and Washington, with Afghan President Hamid Karzai demanding NATO forces leave Afghan villages and withdraw to major bases.

Mr Karzai also demanded that foreign combat troops, most due to leave the country by the end of 2014, stop carrying out controversial night raids of Afghan homes, seen by NATO commanders as one of the most effective anti-insurgent tactics.

Afghanistan's Taliban vowed earlier today to take revenge on NATO forces for the killing of 17 civilians, saying they had no faith in any court proceeding.

Sgt Bales is currently being held at the Leavenworth military prison in Kansas but is assigned to Joint Base Lewis-McChord in Washington state, where the next step in the judicial process will take place.

His attorney, John Henry Browne, suggested today he might use the soldier's mental state as a defence.

"My first reaction to all of this is, prove it ... This is going to be a very difficult case for the government to prove in my opinion. There is no CSI [crime scene investigation] stuff. There's no DNA. There's no fingerprints," Mr Browne told CBS' "This Morning" program before the charges were laid.

But he said: "The mental state eventually will be definitely an issue.”