Sometimes he gets a helping hand from his comrade Ahmed Hassan, who is 15. Ahmed said he was sent to Uganda more than two years ago for army training, when he was 12, though his claim could not be independently verified. American military advisers have been helping oversee the training of Somali government soldiers in Uganda.

“One of the things I learned,” Ahmed explained eagerly, “is how to kill with a knife.”

Children do not have many options in Somalia. After the government collapsed in 1991, an entire generation was let loose on the streets. Most children have never sat in a classroom or played in a park. Their bones have been stunted by conflict-induced famines, their psyches damaged by all the killings they have witnessed.

“What do I enjoy?” Awil asked. “I enjoy the gun.”

Like many other children here, the war has left him hard beyond his years. He loves cigarettes and is addicted to qat, a bitter leaf that, for the few hours he chews it each day, makes grim reality fade away.

He was abandoned by parents who fled to Yemen, he said, and joined a militia when he was about 7. He now lives with other government soldiers in a dive of a house littered with cigarette boxes and smelly clothes. Awil does not know exactly how old he is. His commander says he is around 12, but birth certificates are rare.

Awil gobbles down greasy rice with unwashed hands because he does not know where his next meal is coming from. He is paid about $1.50 a day, but only every now and then, like most soldiers. His bed is a fly-covered mattress that he shares with two other child soldiers, Ali Deeq, 10, and Abdulaziz, 13.

“He should be in school,” said Awil’s commander, Abdisalam Abdillahi. “But there is no school.”

Ali Sheikh Yassin, vice-chairman of Elman Peace and Human Rights Center in Mogadishu, said that about 20 percent of government troops (thought to number 5,000 to 10,000) were children and that about 80 percent of the rebels were. The leading insurgent group, which has drawn increasingly close to Al Qaeda, is called the Shabab, which means youth in Arabic.

“These kids can be so easily brainwashed,” Mr. Ali said. “They don’t even have to be paid.”

One of the myriad dangers Awil faces is constant gunfire between his squad and another group of government soldiers from a different clan. The Somali government is racked by divisions from the prime minister’s office down to the street.