When firefighters arrived, they discovered Mr. Khafra’s “naked, charred body” in the basement of Mr. Beckwitt’s home, and a hole in the floor that dropped about 20 feet down and fanned out into tunnels spanning about 200 feet, according to court documents.

Image Daniel Beckwitt Credit... Montgomery County Police Department, via Associated Press

The state medical examiner determined that the cause of death was smoke inhalation and thermal injuries.

Judge Margaret Schweitzer of Montgomery County Circuit Court sentenced Mr. Beckwitt to 21 years in prison, but she suspended all but the last nine. Sentencing guidelines called for 10 to 21 years in prison, though second-degree murder in Maryland carries a maximum possible penalty of 30 years.

Judge Schweitzer told Mr. Beckwitt, 28, that his “intellectual arrogance” had led to the tragedy, The Associated Press reported. “You thought that everything would be fine because you were very smart,” she said. “You thought you could fix everything.”

Ramon Korionoff, a spokesman for the Montgomery County State’s Attorney’s Office, said in a statement: “Today, defendant Daniel Beckwitt was held accountable in the death of Askia Khafra. While this sentence will not bring back Askia, it does ensure Beckwitt has years to think about the depraved-heart murder of this beloved young man.”