The officer on routine patrol pulled a vehicle over for a traffic violation near Ceres and Cypress avenues in Fontana about 10:40 p.m.
Approaching the vehicle, the officer saw the passenger in the front seat was holding a handgun, according to police.
The suspect then allegedly pointed the gun at the officer. The officer fired his duty weapon several times, striking the suspect, according to police. The officer was not injured.
Two other people were in the vehicle, neither of whom was injured. Police said a handgun was recovered at the scene.
The wounded suspect, identified as 35-year-old Fontana resident Enrique Mendez, was hospitalized under arrest. He was awaiting booking for attempted murder of a police officer.
Fontana Police said another traffic incident involving a gun may be related to the Ceres/Cypress intersection shooting.
Fontana officers responded to a possible traffic collision near Mission and Catawba avenues, in the same general area as the first incident. They discovered the driver, a 44-year-old Victorville resident, was suffering from at least one gunshot wound. He was hospitalized in unknown condition.
Fontana Police said the two incidents appeared to be related. The investigation remained ongoing Tuesday.
As a matter of Fontana Police Department policy, the officer involved shooting is being investigated by the San Bernardino County Sheriff's Department.
It was determined that Enrique Mendez had recently been released as a part of California's realignment plan under AB109, according to police.