A District Heights, Md., man was sentenced to nearly 50 years in prison Friday for fatally shooting his former girlfriend while her preteen daughter — the young girl he helped raise since she was a toddler — was in a nearby bedroom.

D.C. Superior Court Judge Danya A. Dayson said Donald Hairston, 51, not only took a life that night two years ago, he also left devastated a girl who had called him daddy. The child, hearing pops and her mother’s screams, saw the killer rush by and called 911.

“He either disregarded, or depended on, her love of him or her fear of him to keep quiet,” Dayson said. “And I’m not sure which one would be worse.”

Dayson sentenced Hairston to 49½ years in prison in the slaying of Stephanie Goodloe.

As he did during his trial in April, Hairston told the judge and prosecutors that he was not responsible for the June 18, 2016, murder.

“Your honor, I did not do this,” Hairston said with his voice cracking, standing next to his public defenders. “I couldn’t have been there.” As Hairston spoke, several members of Goodloe’s family, including her mother, stormed out of the courtroom.

It was a challenging case for prosecutors. There was no DNA evidence. No murder weapon was found. And around the time of the shooting, Hairston’s cellphone pinged off a cellphone tower miles away from Goodloe’s home in Southeast Washington.

Goodloe, 39, was a victim of domestic violence at the hands of Hairston, who prosecutors argued was consumed with vengeance and control, even after Goodloe ended the relationship.

Months before her death, Goodloe, a youth minister at Mount Gilead Baptist Church in Northwest, had created a paper trail documenting her fear of Hairston. She took out a restraining order against him and filed a police report after she believed he slashed the tires on her car.

Prosecutors used the documents as evidence against Hairston during the April trial.

But the most compelling testimony at trial came when Goodloe’s 13-year-old daughter took the stand. She told jurors that just after 1 a.m. that June morning she was awakened by the “pop” sound of gunshots and her mother’s screams.

Hairston watched as she testified, often wiping tears from his face. Goodloe’s daughter told the jury she was “100 percent certain” Hairston was the man she saw rushing past her bedroom after her mother was shot and then pausing in her bedroom doorway before fleeing the house.

Prosecutors also played the 911 call the girl made when she crept into her mother’s bedroom.

The haunting pleas from the little girl to the 911 operator echoed through the courtroom.

“I’m so scared. I’m scared. Please come. I heard shots. I don’t know what to do. I’m only 11,” she said in the 911 call.

After reciting her address, the girl offered a key statement that prosecutors and Hairston’s attorneys say was critical.

“I didn’t see anything. My head was under the covers. I think it was a man. I think it might have been my stepfather. Please help me.”

A veteran D.C. homicide detective testified during Hairston’s preliminary hearing that he remained “haunted” by that call.

Friends and family members told the jury how Hairston had stolen a set of keys from Goodloe and was able to gain access into her Southeast Washington home.

During the two-week trial, Hairston’s public defenders argued that their client was innocent and had nothing to do with Goodloe’s murder. They said there were other potential suspects and questioned Goodloe’s daughter’s account, noting that in the 911 call the girl said the man she saw “might” have been Hairston.

Prosecutors and Goodloe’s family asked the judge to sentence Hairston to the maximum of 61½ years, while his attorneys asked for a maximum of 30 years in prison. But Dayson said Hairston did not have a history of violent offenses which would have warranted more than 60 years in prison.

Goodloe’s daughter — who is now being raised by Goodloe’s mother — was not present at the sentencing. Still, her presence was felt throughout the hearing as each person who spoke referenced her, including the judge.

“Mr. Hairston was the only father [Goodloe’s daughter] knew. And in one swoop, deprived her of both of her parents, unmindful of the collateral damage to her. And disregarding the impact it would have on her,” Dayson said.

John Goodloe Jr., said that since his cousin’s death, his family has “changed forever.” They not only lost a loved one, he said, they also have become less trusting of those who come into the family as boyfriends, fiances or significant others.

He also spoke of his cousin’s final moments, which he said he believed were centered around her daughter’s safety.

“I know Stephanie’s last moments were in fear for her daughter,” he said. “I know Stephanie wanted to protect her daughter.”

Hairston watched as John Goodloe spoke on behalf of his cousin.

“You not only stole her mother, you stole her innocence,” John Goodloe Jr. said. “You pushed a frightened 11-year-old to be brave, when all she wanted to do was hold her mother.”