A 31-year-old mother in West Chester enabled and sometimes participated in her boyfriend’s brutal abuse and torture of her 9-year-old daughter, prosecutors said Thursday.

The girl, according to the Chester County District Attorney’s Office, had been beaten, forced to walk up and down stairs for hours at a time with her arms stretched out, and locked in a closet for long periods of time.

The abuse was discovered when police responded to the mother’s 911 call early Monday morning after the girl suffered life-threatening injuries — what doctors called a “near fatality,” investigators said — and was unconscious in the bathtub.

Prosecutors charged the mother, Julianne Lewis, with aggravated assault, child endangerment, false imprisonment, and related charges. They had charged the boyfriend, Dimitrios Moscharis, 34, earlier in the week with attempted murder, strangulation, aggravated assault, child endangerment, and related offenses.

The two had been dating for about two months, and Moscharis would abusively discipline the girl over minor issues, the office of Chester County District Attorney Deb Ryan said in a press release and charging documents. Lewis allowed and sometimes participated in Moscharis’ abuse of her daughter, the prosecutors said.

“It is incomprehensible that a mother would not only engage in this horrific treatment of her child but also fail to intervene to protect her from abuse from a man she just met,” Ryan said in a statement. “She participated in a systemic abuse pattern that violated her duty of care and subjected her [daughter] to unimaginable acts of cruelty.”

Ryan vowed to “get justice for this child.”

The girl remained in critical condition Thursday at Nemours A.I. duPont Hospital in Wilmington, the District Attorney’s Office said, and had a litany of injuries and “extensive bruising all over her body.” Doctors said tests showed the girl likely has brain damage because of lengthy oxygen deprivation, a sign of strangulation or suffocation, the office said. Other injuries, prosecutors said, include damage to the connective tissue along her spinal cord, in line with being trapped in a small space.

Lewis called 911 shortly after 1:30 a.m. Monday to report her daughter was not breathing after her boyfriend disciplined her, prosecutors said.

Lewis told investigators she had been driving for Lyft in Northeast Philadelphia when her boyfriend told her to come home, they said. When she called to ask why, he told her the girl had stopped breathing, according to the affidavit of probable cause for Lewis’ arrest. She returned home 45 minutes later, found the girl unconscious, and called 911.

Lewis told police Moscharis had been disciplining her daughter “but he took it way too far,” according to the affidavit. Asked what that meant, she replied: “You see the bruises on her?” She allegedly said Moscharis had initially told her to lie and tell police that it was the girl’s father who injured her.

Investigators found that Moscharis — whose phone they took — had used his Apple Watch to text Lewis, apologizing, they said, and saying he would tell police “it was all me.” Lewis replied that she “admitted to my part too.”

Her role, authorities said, included watching Moscharis beat her daughter on multiple occasions, including with a clothes hanger, his hand, and a plastic rod. Moscharis repeatedly forced the girl into a small closet for 15 to 45 minutes at a time as part of his discipline of her, and made her sleep on the concrete basement floor at least three different times, they said.

On Sunday, when Lewis came home at about 5:30 in the morning after driving for Lyft, her daughter was shut in the second-floor linen closet, according to the affidavit. Lewis left the home at about 6:15, with the girl still in the closet.

Lewis came back at 4:30 Sunday afternoon, then left with Moscharis to buy marijuana. They came back, got high, and fell asleep — all while the girl was trapped in the 2-by-3-foot closet, with clothes dumped on top of her, the DA’s Office said.

At some point, Lewis told investigators, she talked to her daughter through the closet door. But she didn’t try to free her or help her, they said.

Around 9:15 p.m. Sunday, Lewis left to go drive again, according to the affidavit. Her daughter was still in the closet. She wouldn’t see her again until after Moscharis’ text hours later.

Lewis was arraigned Thursday. Both Lewis and Moscharis were taken to county jail without bail. Lewis’ preliminary hearing is scheduled for Dec. 7.