A 74-year-old former police officer has admitted 13 murders, saying an inner voice made him carry out the killings.
Joseph James DeAngelo Jr, known as the Golden State killer, terrorised the Sacramento region as a serial rapist in the mid-1970s before going on to kill more than a dozen people across California, evading capture for decades.
Speaking at a court hearing on Monday, Sacramento County prosecutor Thien Ho said DeAngelo had made incriminating statements after his arrest and indicated he was driven by an uncontrollable force inside him.
Mr Ho said that when DeAngelo was alone in a police interrogation room, he began speaking to himself, saying: "I did all that".
DeAngelo is said to have added: "I didn't have the strength to push him out. He made me. He went with me. It was like in my head, I mean, he's a part of me.
"I didn't want to do those things. I pushed Jerry out and had a happy life. I did all those things. I destroyed all their lives. So now I've got to pay the price."
The prosecutor said the time had come for DeAngelo to pay the price, adding: "The scope of Joseph DeAngelo's crimes is simply staggering. Each time he escaped, slipping away silently into the night."
DeAngelo entered the guilty pleas as part of a broader agreement with prosecutors to admit to all allegations against him - including dozens of rapes too old to prosecute - dating back to the mid-1970s.
The plea deal will spare him from a potential death sentence but he will face a sentence of life in prison without the possibility of parole.
Prosecutors said the deal would prevent ageing survivors, victims' families and witnesses from prolonged legal proceedings.
DeAngelo was arrested in 2018 after authorities used DNA to track him using a popular genealogy website.
It capped more than four decades of investigation after the case gained renewed attention when the bestselling book I'll Be Gone in the Dark was released.
DeAngelo's victims are expected to confront him at his sentencing in August.