ROCKVILLE, Md. — A wealthy stock trader was sentenced Monday to nine years in prison for his conviction in the fiery death of a man who was helping him secretly dig tunnels for a nuclear bunker beneath a Maryland home.

Daniel Beckwitt, 28, apologized to the parents of 21-year-old Askia Khafra, who was burned beyond recognition by the September 2017 fire that broke out above the tunnels they were digging in a suburb of Washington, D.C.

"If there was something I could do to bring Askia back — anything — I would jump at that chance," said Beckwitt, who didn't testify at his trial in April before a jury convicted him of second-degree murder and involuntary manslaughter. "I most certainly did not intend for any of this to happen."

Beckwitt had faced a maximum of 30 years in prison when Montgomery County Circuit Court Judge Margaret Schweitzer sentenced him. In total, Beckwitt was sentenced to 21 years but the judge suspended all but nine years of the sentence. Sentencing guidelines had called for a prison term of 10 to 21 years.

Beckwitt repeatedly nodded his head as the judge explained why she settled on a sentence that slightly departed from the guidelines. Schweitzer told him that his "intellectual arrogance" led to the tragedy.

"You thought that everything would be fine because you were very smart," she said. "You thought you could fix everything."

She told Khafra's parents the length of Beckwitt's prison sentence doesn't equate with their loss.

"My sentence will not and cannot give you justice," Schweitzer told them.

Beckwitt wiped away tears as Dia and Claudia Khafra, Askia's parents, described how their son's death has left indelible scars on their lives.

"Askia's death has left me broken," Claudia Khafra said. "I am constantly plagued by feelings of emptiness."

During the trial, Montgomery County prosecutor Marybeth Ayres accused Beckwitt of recklessly endangering Khafra's life. Beckwitt ignored obvious signs of danger and sacrificed safety for secrecy while they dug a network of tunnels beneath a home in Bethesda, the prosecutor said.

Defense attorney Robert Bonsib had told jurors the fire was an accident, not a crime. He described his client as an idiosyncratic but "incredibly brilliant" man who never intended any harm.

"This is a passive omission. This is a failure to clean up the house," he said Monday. "That's what he was on trial for, the consequences of failing to keep the basement clean."

Firefighters found Khafra's naked, charred body in the basement of Beckwitt's trash-filled house, only a few steps from an exit. Prosecutors said the extreme hoarding conditions in the home prevented Khafra from escaping.

Ayres said Beckwitt has shown a lack of empathy and a willingness to squander his brilliance.

"And the result is harming others," the prosecutor added.

Hours before the fire broke out in the basement, Khafra texted Beckwitt to warn him it smelled like smoke in the tunnels. Ayres said Beckwitt didn't respond for more than six hours before telling Khafra that there had been a "major electrical failure." Instead of getting Khafra out of the tunnels, Beckwitt told him that he "just switched it all over to another circuit," according to the prosecutor.

Bonsib said Beckwitt screamed for help from neighbors after the fire broke out and tried to rescue his friend from the blaze before heavy smoke and flames forced him to retreat.

Khafra met Beckwitt online. Beckwitt had invested money in a company Khafra was trying to launch as he helped Beckwitt dig the tunnels.

Beckwitt went to elaborate lengths to keep the project a secret. He tried to trick Khafra into thinking they were digging the tunnels in Virginia instead of Maryland by having him don "blackout glasses" before taking him on a long drive. Khafra had a cellphone with him in the tunnels, but Beckwitt used internet "spoofing" to make it appear they were digging in Virginia.

Khafra worked in the tunnels for days at a time, eating and sleeping in there and urinating and defecating into a bucket Beckwitt lowered down to him. The tunnels had lights, an air circulation system and a heater.

A hole in the concrete basement floor led to a shaft that dropped down 20 feet (6 meters) into tunnels that branched out roughly 200 feet (60 meters) in length. Investigators concluded the blaze was ignited by a defective electrical outlet in the basement.

A prosecutor has described Beckwitt as a skilled computer hacker who had a paranoid fixation on a possible nuclear attack by North Korea. In 2016, Beckwitt spoke at a hacker convention using the alias "3AlarmLampscooter" and wearing a fire-resistant suit and visor that obscured his face. Bonsib has said Beckwitt's use of a pseudonym and disguise was harmless, typical of the "weird things" people do on the internet.

Khafra's parents filed a wrongful death lawsuit against Beckwitt on the anniversary of the Sept. 10, 2017, fire.