DALLAS (AP) — A Texas man was convicted of capital murder in the beating death of his girlfriend's 4-year-old daughter, with the judge telling the defendant he "should die in a locked closet" for abusing the girl.

Monday's guilty verdict by the Dallas County jury brought with it an automatic life sentence for Charles Wayne Phifer, 36, of Grand Prairie. Leiliana Wright was beaten to death in March 2016.

The girl's 33-year-old mother, Jeri Quezada, testified against Phifer, who she said bound Leiliana's hands behind her back and strung the little girl up in a closet.

Judge Robert Burns told Phifer, "Hanging a little girl in a locked closet was savage. You should die in a locked closet."

During the trial, jurors were shown photos of Leiliana's battered body, covered from head to toe in bruises.

Quezada pleaded guilty to felony injury to a child as part of a plea agreement that will send her to prison for 50 years. She'll be formally sentenced Wednesday.

At Phifer's trial, Quezada admitted that she would sometimes hit her daughter, saying she used a switch made from bamboo to strike the girl's legs.

Defense attorneys argued that Quezada was trying to save herself by blaming Phifer for her daughter's death. Prosecutors Eren Price and Travis Wiles argued that Quezada and Phifer were responsible for Leiliana's death but that Phifer was the person alone with the child for hours the day of her deadly beating.

Wiles said Quezada's story about the 48 hours or so before Leiliana's death is corroborated by cellphone records. Those records showed Quezada was away for much of the day.

Leiliana's death exposed failures by Child Protective Services. CPS fired two employees and a third resigned after the agency was accused of failing to prevent Leiliana's death.

Reports of abuse had included Leiliana's paternal grandmother saying that the girl showed up to a visit in February 2015 with bruises and a busted lip, but CPS rejected that abuse allegation.

The agency had also started looking into the girl's wellbeing in the months before her death. But records show a caseworker failed to check on her for more than a month and when a child abuse investigator did check on her, he left her in the care of Quezada despite Leiliana's black eye.