A Los Angeles man who opened fire on people at random in 2014, killing five people and wounding seven others, was sentenced Thursday to life in prison without the possibility of parole.

Alexander Hernandez, 42, from the city’s Sylmar neighborhood, was sentenced to multiple consecutive life terms for the rampage.

The Los Angeles County district attorney’s office initially sought the death penalty for Hernandez but dropped that request in 2021. After his 2020 election, District Attorney George Gascón issued a policy that in general bars prosecutors from seeking capital punishment.

Authorities said Hernandez attacked people in the city’s San Fernando Valley, mainly between March and August 2014. In addition to killing or wounding people, he was charged with opening fire on four people, including two 12-year-old children who were in a car with their parents.

Many victims were shot while in their cars, driving home from work, or heading to church or other activities. One man was killed while standing in a parking lot, another while walking in a Sylmar park, and a teenager was shot in his car and paralyzed after dropping off his girlfriend after their high school prom, authorities said.

Authorities said there was no discernible motive for the attacks. In some of them, Hernandez fired from his own vehicle, emblazoned on the back with stickers of “a white skull” and the numerals “666,″ authorities said.

In others, he stalked victims before opening fire with a shotgun, prosecutors said.

Hernandez pleaded not guilty by reason of insanity but withdrew the plea before his trial, which stretched on for years while he remained in custody.

He was convicted last May of five counts of murder with special circumstances, 11 counts of attempted murder and more than a dozen other charges, including animal cruelty and being a felon in illegal possession of a firearm.

Before his murder trial, he pleaded no contest to shooting several dogs, killing two of them.