Authorities have identified the gunman and victims in a rampage that left six people, including the shooter, dead in Bakersfield, Calif., on Wednesday.

“The way that this went down, it appears this is well planned,” said Kern County Sheriff Donny Youngblood during a news conference Thursday. It appeared that the gunman, Javier Casarez, targeted all five victims, among them his ex-wife, Youngblood said. He added there seemed to be “implications of domestic violence,” though a precise motive for the killings has not been determined.

Casarez had been divorced from his wife, Petra Maribel, for four months and had recently appeared in court about child support and dissolution of marital property.

The shooting began just after 5 p.m., when Casarez and Maribel arrived at an east Bakersfield trucking business. Casarez confronted and killed another man, Antonio Valdez, 51, and then fatally shot Maribel, 45, Youngblood said.

According to the sheriff, Casarez then chased and gunned down his third victim, Manuel Contreras, 52, outside a nearby gun shop.

A witness who was working in the complex told The Washington Post he heard multiple shots in a matter of minutes. He bolted outside and saw the shooter running away.

“It’s a big industrial area, so we hear loud noises all the time. I thought, ‘What was that? Did a tire blow?’ Then I saw a guy with a gun, shooting,” said the witness, who spoke on the condition of anonymity. “I saw another man screaming, ‘Policia! Policia! There’s a crazy man with a gun!’ ”

Casarez fled to a nearby neighborhood and headed to a Breckenridge Road residence, the sheriff said. There, he shot Laura Garcia, 31, a mother of four, and her father, Eliseo Garcia, 57.

Soon after, Casarez hijacked a vehicle with a mother and child inside. Both passengers were able to escape unharmed, Youngblood said.

Several deputies confronted Casarez, who was nearing the highway, before he turned the gun on himself.

The Kern County Sheriff’s Department is still investigating the “devastating event.” The coroner is also looking into whether Casarez was under the influence of drugs or alcohol.

“Sometimes these domestic violence cases morph into something very bad. We want to find out how these other players fit into this domestic violence issue,” Youngblood said.