KABUL, Afghanistan — An Afghan soldier arrested in the shooting death of one coalition soldier and the wounding of four others last week escaped from custody on Sunday morning after a soldier guarding him devised an elaborate ruse to sneak him out through a military hospital, officials said.

The imprisoned soldier, identified as Lamber Khan, and his guard escaped from an Afghan Army base in the southern province of Kandahar, according to Gen. Abdul Hameed, the commander of the Afghan 205th Army Corps.

In concocting their escape, General Hameed said, the guard, who was a supervisor, filled out a hospital card for Mr. Khan, allowing him to leave the detention wing of the base and visit the military hospital. There, the guard was able to unshackle him, and the two men were able to escape together.

“He was a trustworthy person, and we do not know what made him release the culprit and escape with him,” said General Hameed, who noted that the guard was from around the same area as the prisoner, the eastern city of Jalalabad.