Southern California sheriff's deputies shot and killed man who struck a deputy with his car and then charged at them with a knife, authorities said.

The shooting occurred after deputies investigating a retail theft pulled over a Toyota Matrix Saturday evening in Rancho Cucamonga, said the San Bernardino County Sheriff’s Department.

As the deputies searched the Toyota, a Hyundai Elantra approached from the north and "accelerated towards the deputies, hitting one of them and pinning him between the two vehicles," said a sheriff's department statement.

SURVEILLANCE FOOTAGE SHOWS RELATIVE PUSH TODDLER OFF CHICAGO'S NAVY PIER AND INTO LAKE: REPORT

Suspect hits officer with car in CA

A suspect was fatally shot after he pinned a deputy between two vehicles and charged at the officers with a knife in San Bernardino, California, on Sept. 24, 2022. (Fox News)

The driver of the Hyundai then exited the car wielding a knife and "aggressively approached the deputies," prompting them to open fire, according to the statement.

The Hyundai's driver, a 34-year-old resident of Santa Monica, was struck by gunfire and taken to a hospital, where he died, officials said.

CHICAGO RESIDENTS ON EDGE AFTER WOMAN WAS ATTACKED IN BROAD DAYLIGHT IN RITZY NEIGHBORHOOD

The deputy struck by the car was recovering at home after being treated at a hospital for injuries to his leg.

The investigation was ongoing Sunday.