CLEVELAND (AP) — The Cleveland man accused of holding three women captive in his home for about a decade agreed to plead guilty Friday in a deal to avoid the death penalty.

In exchange, Ariel Castro would be sentenced to life without parole plus 1,000 years, prosecutors said.

Castro was in court Friday morning to enter the guilty plea. When asked if he understood he would never be released from prison, Castro said: "I do understand that, your honor." He added, "I knew I was pretty much going to get the book thrown at me."

Castro, wearing glasses for the first time in court, was far more interactive than in previous court appearances when he mostly kept his head down and eyes closed. During Friday's hearing, he answered the judge's questions in a clear, intelligible voice, saying he understood the proceedings and that he would never be released from prison.

Castro, who was born in Puerto Rico, said he could read and understand English well but had trouble with comprehension.

"My addiction to pornography and my sexual problem has really taken a toll on my mind." He later said he had been a sexual abuse victim as a child, but the judge cut him off.

The deal comes more than a month after a statement issued on behalf of the women said they were "hopeful for a just and prompt resolution" and had "great faith in the prosecutor's office and the court."

Castro, 53, had been scheduled for trial Aug. 5 on a 977-count indictment. The indictment included two counts of aggravated murder related to accusations that he punched and starved one woman until she miscarried. The former school bus driver also was charged with hundreds of counts of kidnapping and rape, plus assault and other counts.

He was accused of repeatedly restraining the women, sometimes chaining them to a pole in a basement, to a bedroom heater or inside a van. The charges alleged Castro assaulted one woman with a vacuum cord around her neck when she tried to escape.

The sticking point on a plea deal had been whether the prosecutor would rule out the death penalty. The Cuyahoga County prosecutor had kept that issue under review.

Story continues

The three women disappeared separately between 2002 and 2004, when they were 14, 16 and 20 years old. Each said they had accepted a ride from Castro, who remained friends with the family of one of the women and even attended vigils over the years marking her disappearance.

The women escaped Castro's house May 6 when one of them kicked out part of a door and called to neighbors for help. Castro was arrested within hours and has remained behind bars.

News that Amanda Berry, Gina Dejesus and Michelle Knight had been found alive electrified the Cleveland area, where two of them were household names after years of searches, publicity and vigils. But elation soon turned to shock as allegations about their treatment began to emerge.

Castro fathered a 6-year-old daughter with Berry, authorities said. They allege that on the day the child was born, Christmas 2006, Castro raped one of the other women, who had helped deliver the baby.

Berry told authorities that she, her child and the other women never saw a doctor during their captivity.

Knight said her five pregnancies ended after Castro starved and repeatedly punched her.

The Associated Press does not usually identify people who may be victims of sexual assault, but the names of the three women were widely circulated after they disappeared, and they appeared in an online video thanking the public for its support. They otherwise have sought to stay out of sight and have appealed for privacy.