SAN DIEGO — A man who killed four people, including three homeless men, and attacked several others throughout San Diego during a spree of attacks in 2016 pleaded guilty Monday to 15 felonies, including four counts of murder, and will be sentenced to more than four consecutive life terms later this year.

Jon David Guerrero, 42, will be given four consecutive life without parole prison sentences, plus 143 years to life, when he’s sentenced May 1.

Guerrero, who was set to go to trial in June, pleaded to charges that include murder, attempted murder, assault, and arson, plus a special circumstance allegation of committing multiple murders. He faced a potential death penalty had the case gone to trial, but the capital punishment decision was never made by the San Diego County District Attorney’s Office.

The charges cover attacks on 13 separate victims between February and July of 2016, though most of the attacks occurred in the summer months.

The defendant set some of the victims on fire, while others were impaled with railroad spikes.

A definitive motive was never disclosed, though preliminary hearing testimony indicated Guerrero told the first victim in the series of attacks that he attacked him, “Because you’re a bum.”

Monday’s plea signals the end of court proceedings spanning more than three years, which included numerous mental competency hearings and multiple stays at Patton State Hospital. Guerrero is expected to remain at the hospital until sentencing, at which point he will serve his time in state prison.

Deputy District Attorney Makenzie Harvey said, “It’s a huge, huge relief to have a finality to this when it has seemed for the last three years with our stops and starts, that we might not get finality for a while. This is, I think, a very, very great thing for the victims and their families.”