The suspect shot the officer with a rifle. (Representational)

A California Highway Patrol (CHP) officer was killed along with the suspected gunman during a shootout in southern California on Monday, police said. Two other officers were wounded.

The shootout occurred around 5:30 p.m. (0030 GMT) in Riverside, California, about 55 miles (86 km) east of Los Angeles just off U.S. Interstate 215, CHP Assistant Chief Scott Parker said at a press conference.

The motorcycle patrol officer had stopped a white GMC pickup truck, determined that the truck was to be impounded and called for a tow truck, Parker said. The suspect grabbed a rifle from the truck and shot the officer.

The officer was identified by the California governor's office as 34-year-old Andre Moye. The suspect's name hasn't been released.

"He engaged our officer with multiple gunshots," Parker said. "Our officer was struck during this gun battle."

The officer broadcast a call for help and the CHP and officers from multiple other agencies rushed to the scene, Parker said.

The first two additional officers at the scene were also CHP and both were shot, he said, including one who was in critical condition at a hospital. The other officer suffered only minor injuries.

Other officers arrived and started shooting, Parker said, eventually hitting and killing the suspect. Dozens of rounds were fired, local media said, and motorists stopped in traffic fled their vehicles and ran for cover, media reports said.

Local broadcast media showed images of CHP patrol cars and other vehicles with shot-out windows.

Several motorists were struck by glass shards when bullets hit their car windows, officials said, and were treated by paramedics at the scene.

The first officer was flown by a helicopter ambulance to a local hospital, where he died, Parker said.

The slain officer, Moye, graduated from a police academy in 2017 and had been a CHP officer for almost three years, a release from the governor's office said.

Flags at the capitol will be flown at half-staff in his honor, the governor's office said.

Riverside Police officer Ryan Railsback told local media that the motive behind the shooting was not yet known. That will be part of a "very long" and "complex" investigation, Railsback said.