Staff Sergeant Robert Bales, of the 2nd Battalion, 3rd Infantry Regiment, was also accused of six counts of assault and attempted murder in the Panjwai district of Kandahar province earlier this month.

The killings -- mostly of women and children -- are believed to be the deadliest war crime by a NATO soldier during the decade-long conflict and have tested Washington and Kabul's already tense relationship to the limit.

Responding to the charges, a spokesman for Afghan President Hamid Karzai said: "We want justice and we want it as soon as possible," while a spokesman for Bales's home base said it will likely be 18-24 months until any trial.

In a statement, the US military said the maximum punishment for premeditated murder is "a dishonourable discharge from the armed forces, reduction to the lowest enlisted grade, total forfeiture of pay and allowances, and death."

The mandatory minimum sentence for the killings of nine children, four women and four men, and attacks on four children, one man and one woman is life imprisonment with the possibility of parole, it added.

Bales, 38, is currently being held at Fort Leavenworth in Kansas, and a US forces spokesman said it was "more than likely" the trial would be held in the United States, although the decision would be made later in the process.

But furious relatives of the victims have demanded proceedings take place in Afghanistan.

Haji Samad, an elder who lost 11 members of his family, said: "He committed the crime in Afghanistan. Why he is going to be prosecuted in the US?"

Bales allegedly walked off his base in the southern province of Kandahar under cover of darkness March 11 and killed 17 people in two nearby villages, burning some of their bodies before returning to his base and surrendering.

The massacre has deepened a sense of crisis in the NATO mission and renewed questions about the effect of protracted ground wars on America's stretched force, becoming just the latest in a series of damaging setbacks since January.

The burning of Holy Quran in mid-February triggered deadly anti-US protests, there has been a surge in "insider" attacks on NATO troops by Afghan forces and a video emerged of US Marines urinating on bloodied Taliban corpses.

The next stage in the Bales case will see him appear before a so-called Article 32 hearing, which will decide whether to proceed with a court-martial -- but the military has almost four months in which to hold it.