When the bodies of four people were found on the dirt floor of a West Philadelphia basement in 2018, little was known about the crime beyond the fact that the victims unmistakably had been executed.

But last year, a witness testified in a hearing that they were killed by gunmen who wanted to steal just $105 worth of heroin.

As the two shooters were sentenced Friday to decades in prison, additional disturbing facts were revealed.

Keith Garner and Jahlil Porter had been friends with the two men they shot in the head. And in the days after the slaughter, Garner texted Porter a message thanking him “for bringing the beast back out of me.”

“I knew it was in you,” Porter replied, “and just needed to be released.”

The details emerged during a four-hour sentencing hearing, in which Common Pleas Court Judge Barbara A. McDermott ordered Porter, 34, to spend at least 50 years in prison, and Garner, 35, to at least 40 years.

McDermott — a longtime homicide judge who previously worked as a defense attorney and prosecutor — said the crime was unique in its brutality, and was startled to learn that the two men had been friendly with victims William Maurice Taylor, 31, and Akeen Mattox, 28.

“It’s bad enough when you kill a stranger, but you hung out ... with Mr. Maurice Taylor,” McDermott told Porter. “It is very, very rare that this court sees a case that cannot be described as anything other than an execution.”

Relatives and friends of the victims also testified at the hearing, saying the crime had left them traumatized and scared. Taylor and Mattox considered each other stepbrothers, and the females who were killed — Tiyaniah Hopkins, 20, and Yaleah Hall, 17 — were sisters.

“My children are scared to enter the basement thinking something’s going to happen to them,” the girls’ mother, Thomasina Hall, said in a statement read by prosecutor Danielle Burkavage.

Taylor’s cousin James Cade testified that he was so distraught by the killings that he struggled to work or function. “Y’all didn’t have to kill him,” he said to Porter and Garner. “Y’all know that.”

On Nov. 18, 2018, Garner, Porter, and a third man, Robert Long, went to Taylor’s house on the 5100 block of Malcolm Street. Long was the driver. According to previous testimony, Taylor and Mattox had offered to sell them a batch of heroin they’d found. Garner and Porter decided they wanted to simply steal the drugs instead.

They entered the house and went with the four people inside to the basement, where the robbery went wrong. Garner was the first to shoot, hitting Taylor in the chest because Taylor — who had been ordered to take off his clothes — had started to scream, Garner admitted Friday.

That shot by itself would have killed Taylor, McDermott said. But Porter left no doubt, pulling out a gun and shooting Taylor in the head, then firing one shot into the head of each of the other victims as well.

Garner admitted Friday that the two females had nothing to do with the drug stash and simply happened to be in the house at the time.

He also acknowledged, under questioning by McDermott, that Taylor likely began to scream in part because he had intellectual disabilities.

“I’m not going to make no excuses for what I did,” Garner said. “He started screaming, and [shooting] was my first reaction.”

Long, 32, did not fire a shot, but pleaded guilty and has been sentenced to at least 25 years in prison. He has filed a motion asking for that sentence to be reconsidered.

Garner and Porter each apologized for their actions Friday.

“I know I owe all of you so much more than words, and I’m sorry,” Porter told the victims’ friends and relatives during the virtual hearing, conducted over Zoom. He could be seen crying at times, and frequently dipped his head as the relatives testified.

“I know it seemed like everybody was supposed to die, but it was just supposed to be a robbery, and it went bad,” Garner said. “I’m sorry for what happened. I’m not going to sit here and put the blame on nobody.”

Burkavage had asked McDermott to impose prison sentences of 80 years on Garner and Porter. McDermott said that although she found the crime “outrageous,” each man should have the opportunity to convince a parole board they should be eligible for release several decades from now.

Kenya Mattox, a sister and stepsister to two of the victims, said her family had been “broken” by the killings.

Perhaps the hardest part, she said, is trying to reconcile that four people were killed “for something so small.”