The suspect who allegedly shot a Harris County deputy reportedly wounded three more officers on Thursday evening.

A five-hour-long standoff happened in law enforcement’s pursuit of Terran Green, 34, who had allegedly shot and critically wounded Deputy Joseph Anderson the previous night, according to KHOU 11.

Sheriff Ed Gonzalez told reporters that Green had barricaded himself inside a home at the 11500 block of Silhouette Ridge in northeast Harris County, according to the Houston Chronicle.

When officers approached the house, they were allegedly shot at by the suspect. Deputy Shaun O’Bannion and two U.S. marshals were injured and taken to the hospital but are expected to be okay.

SWAT surveilled the scene and used an armored vehicle to tear down the front of the house in a bid to convince Green to surrender. He was eventually taken into custody.

“We are very grateful right now that we are not planning four funerals tomorrow,” said Harris County District Attorney’s Office Division Chief Katie Warren, according to KHOU 11.

Months prior to the recent officer shootings, Green had been pulled over for a traffic stop.

He allegedly pointed his gun at his girlfriend and said, “I’m going to end you.” He had two felony charges against him at the time but was released on bond.

Green has been to prison three times, and the Harris County Deputies Organization is calling for the judge who placed his bail at $55,000 to resign.

He is scheduled for court on August 21. If he is convicted, he will be facing 25 years to life in prison.

In nearby Dallas, there have been 159 homicides so far this year, according to police data updated on August 19.

Complicating the matter is the ongoing staffing shortage at the Dallas Police Department, which is short about 900 of the 4,000 officers a previous City analysis deemed ideal for policing a city of Dallas’ size.

Fort Worth reportedly has a dedicated unit patrolling its downtown area alongside private security guards, which has seen success in reducing crime in the area.