A Bristol Township man who admitted to sexually assaulting a girl nearly every month for two years has been ordered to serve up to two decades in state prison after he accepted a plea deal, authorities said Wednesday.

Darrius Prince, 35, had pleaded guilty to charges that include the rape of a child, the Bucks County District Attorney's Office said. Had Prince not accepted the plea deal and instead been convicted at trial, Raymond McHugh, a judge in Bucks County Court, said, Prince "would be receiving a much, much longer sentence."

The Monday plea agreement — under which Prince must serve a minimum of seven years in prison — spared the victim from having to testify in court and endure more trauma, authorities said. According to a news release from the prosecutor's office, Prince began sexually assaulting the child in 2015, when she was 11.

Prince admitted to sexually assaulting the child when he went to the emergency room of Lower Bucks Hospital on Oct. 24, 2017, saying he wanted to kill himself over what he did, authorities said. After he had left for the hospital, Prince's wife told police officers who came to her home for a report of a suicidal person that her husband wanted to die by suicide because of "sexual misconduct activities," according to a probable cause affidavit.

"I'm very sorry for what I did," Prince told McHugh in court Monday. "I'm not going to ever let it happen again."

Authorities said Prince will be on probation for 20 years after being released from prison. He will also have to register with the Pennsylvania State Police as a sex offender.