Staff Sgt. Robert Bales was charged on Friday with 17 counts of premeditated murder and six counts of assault and attempted murder in connection with a March 11 attack on Afghan civilians, American forces in Afghanistan said.

If convicted of premeditated murder, Sergeant Bales could face the death penalty, according to the announcement, which was made by American officials in Kabul.

Afghan and American officials have said that Sergeant Bales, a 38-year-old soldier from Joint Base Lewis-McChord in Washington State serving his fourth combat tour overseas, walked away from his remote outpost in southern Afghanistan and shot and stabbed members of several families in a nighttime ambush. Many officials initially said that 16 people were killed in the rampage; at least 9 were children and others were women. But the military said Friday that Sergeant Bales was accused of killing 17 Afghan civilians.

Afghan officials on Friday, however, stuck to the initial death toll. None of the six people whom Sergeant Bales is accused of assaulting and attempting to murder had died from wounds sustained in the attack, though three remain hospitalized, said Zalmai Ayoubi, a spokesman for the government of Kandahar Province, where the killings took place.