JURUPA VALLEY, Calif. (AP) — A Southern California sheriff’s deputy was shot and killed Thursday by a man with a violent criminal history during a traffic stop and the suspect later died in a shootout on a freeway, authorities said.

Isaiah Cordero, 32, had pulled over a pickup truck just before 2 p.m. in the city of Jurupa Valley, east of Los Angeles. As he approached the vehicle, the driver pulled a gun and shot him, Riverside County Sheriff Chad Bianco said at an evening news conference.

A witness called 911 and residents tried to help Cordero until paramedics arrived but he was pronounced dead at a hospital.

A “massive manhunt” then began for the shooter and he was spotted in neighboring San Bernardino County, sparking a chase on freeways through both counties. A spike strip disabled two rear wheels but the truck kept going, the sheriff said.

TV news showed dozens of Sheriff’s Department and California Highway Patrol cars chasing the truck.

On Interstate 15 in Norco, the truck finally became disabled, losing an axle, and crashed, Bianco said.

“At the conclusion of the pursuit, the suspect fired rounds at deputies” with a handgun and they shot back, killing him, Bianco said.

The suspect, William Shae McKay, 44, of San Bernardino County, had a long and violent criminal history stretching back to before 2000 that included kidnapping, robbery and multiple arrests for assault with a deadly weapon, including the stabbing of a California Highway Patrol dog, the sheriff said.

Cordero was a motorcycle officer assigned to Jurupa Valley, a city about 45 miles (72 kilometers) east of downtown Los Angeles that contracts with the Riverside County Sheriff’s Department for policing services.

Cordero joined the 4,000-member strong department as a corrections deputy, worked in local jails, became a sworn deputy in 2018 and completed motor school to become a motorcycle deputy in September, Bianco said.

Cordero “learned from his mother the value of serving and helping others” and his goal at the department was always to become a motor deputy, Bianco said.

“He was naturally drawn to law enforcement and certainly embodied our motto of service above self,” Bianco said. “He was a jokester around the station and all of our deputies considered him their little brother.”

The sheriff said McKay had been convicted of a “third strike” offense last year that should have put him in state prison for 25 years to life but a San Bernardino County judge lowered his bail, allowing his release, and later released him following an arrest for failing to appear at his sentencing.

“He should have been immediately sentenced to 25 years to life,” Bianco said. “We would not be here today if the judge had done her job.” Bianco said.

Several hours after the shooting, dozens of motorcycle officers and patrol cars escorted a hearse transporting the deputy’s flag-draped casket from the hospital to the county coroner’s office.