The officers responded around 4:10 a.m. to a report of broken windows and a disturbance at America's Best Value Inn at 3331 North Texas St., Fairfield police Sgt. Matt Bloesch said.
Multiple shots had been fired at the motel before the officers arrived, Bloesch said.
The officers saw a suspect running from the scene and gave chase. During the pursuit, the suspect allegedly fired a handgun at the officers, who returned fire and struck the suspect in the leg, Bloesch said.
The officers were not hit by the gunfire and the suspect, identified as Jerry Andrews, 30, of Fairfield, was taken to a hospital for treatment of his injuries, which were not life-threatening, according to Bloesch.
Andrews will be booked in Solano County Jail on suspicion of attempted murder of a police officer, possession of narcotics for sale, being a felon in possession of a firearm and criminal conspiracy, police said.
Police also arrested Aaron Minor, 23, of Fairfield, who was with Andrews at the motel. Minor was arrested on suspicion of possession of narcotics for sale and criminal conspiracy. Bloesch said.
The officers involved in the shooting have been placed on paid administrative leave, Bloesch said.
Fairfield police and the Solano County District Attorney's Office are investigating the shooting.