The man accused of gunning down Deputy Fernando Esqueda in an ambush attack was arrested overnight and has been charged with capital murder, according to Harris County, Texas, authorities.
The suspect, Ronnie Palmer, was also accused of aggravated assault following an incident at a Little Caesars pizza shop.
The incident began just after 10 p.m. Wednesday when Harris County deputies responded to an aggravated assault at the Little Caesars, Harris County Sheriff's Office Chief Deputy Mike Lee said at a news conference earlier Thursday.
MORE: String of shootings appear to target random drivers, bicyclists in Charlotte; police offer reward"What happened is senseless," Lee said early Thursday. "The suspect came into the location to pick up a pizza that he had ordered."
"He was upset because the order was incorrect," Lee said.
The suspect allegedly verbally assaulted the employee, "then produced a firearm and pistol-whipped the employee and then fled the location," Lee said.
"The employee at Little Caesars was able to identify the getaway car by make and model, color and license plate," Lee said.
Esqueda spotted the suspect's car, Lee said. Esqueda then "had a phone conversation with one of the other detectives to let him know he did have the suspect vehicle in sight," Lee said.
While on the phone, "our deputy apparently was ambushed" and shot multiple times, Lee said.
Other detectives rushed Esqueda to a hospital where he died almost immediately after arriving, Harris County Sheriff Ed Gonzalez told reporters.
Esqueda, 28, was a five-year veteran of the department, Gonzalez said.
"So much promise unfulfilled," Gonzalez said.
MORE: Police build Lego heist case after $200,000 in sets seizedEsqueda was a "member of a very elite task force, the violent persons task force," Lee said.
"He went after the worst of the worst," the sheriff added.
Gonzalez previously announced that Palmer was wanted in the assault at Little Caesars and that he had been identified as a person of interest in the capital murder of Esqueda.
Editor's Note: Deputy Fernando Esqueda was on duty at the time of the shooting. A previous version of this story said he was off duty at the time.