A man was charged Thursday with attempted capital murder in the shooting of two police officers that sparked a nine-hour standoff at an apartment complex in Odessa, Texas.

Police say Roy Daniel Garza, 27, fired at Sgt. Pete Gonzalez and Officer Cory Wester as they tried to arrest him on a parole violation Wednesday, sparking the standoff that lasted until Garza surrendered around 9 p.m.

Gonzalez was shot in the arm and Wester suffered wounds to the chest and upper leg, police said in a statement. Both were in fair condition at Medical Center Hospital in Odessa, Debra Richardson, a hospital official, said Thursday morning.

Garza, of San Antonio, was being held on eight counts of attempted capital murder of a peace officer, Texas Department of Public Safety trooper Elena Viramontes said in an email. He is also being held on an outstanding aggravated robbery warrant from Williamson County, more than 300 miles away, according to Ector County jail records.

Odessa police Cpl. Steve LeSueur said Garza suffered a leg wound during the standoff. Garza was treated at the same Odessa hospital as the officers he wounded.

Jail records do not list an attorney who can speak on Garza's behalf, and no bond was immediately set.

Garza's girlfriend was inside the apartment during the standoff, but walked out on her own and was not harmed, LeSueur said.

The Department of Public Safety's Texas Rangers are investigating the incident.