Authorities have charged a 30-year-old man with capital murder, after they say he ambushed a Texas county sheriff’s deputy at a suburban Houston gas station in an attack motivated by "absolute madness."

Harris County Sheriff Ron Hickman identified the man in a news conference Saturday afternoon as Shannon J. Miles, who is in police custody.

Miles — who has a criminal history that includes convictions for resisting arrest and disorderly conduct with a firearm — was arrested less than 24 hours after authorities said he ambushed Darren Goforth, a 10-year veteran of the Harris County Sheriff's Office, at a suburban Houston Chevron station.

"I am proud of the men and women that have worked swiftly to apprehend the responsible person who posed a significant threat to both law enforcement and the community at large," Hickman told reporters Saturday. "Our deputies return to the streets tonight to hold a delicate peace that was shattered last evening."

Hickman said the motive for the killing had not been determined but investigators would look at whether Miles, who is black, was motivated by anger over recent killings elsewhere of black men by police that have spawned the "Black Lives Matter" protest movement. Goforth was white.

More On This...

"I think that's something that we have to keep an eye on," Hickman said. "The general climate of that kind of rhetoric can be influential on people to do things like this. We're still searching to find out if that's actually a motive."

Hickman said investigators are working on the assumption "that he was a target because he wore a uniform."

In a statement Saturday, Texas Gov. Greg Abbott said "heinous and deliberate crimes against law enforcement will not be tolerated" and that the state "reveres the men and women in law enforcement who put their lives on the line every day to protect and serve their communities."

In an earlier news conference on Saturday, Hickman and District Attorney Devon Anderson both had strong words for what they said was an unprovoked attack targeting law enforcement, while touching on the recent climate of tension between civilians and law enforcement.

"We've heard black lives matter, all lives matter. Well, cops' lives matter, too," Hickman said.

Anderson said that there are bad individuals in every field, but that "there should not be open warfare on law enforcement officers."

Goforth, 47, was near a gas pump when the gunman approached him from behind and opened fire, Harris County Sheriff’s Office spokesman Ryan Sullivan told The Associated Press.

Hickman said Goforth was a “dedicated law enforcement officer” who had been a on the force for 10 years. He had a wife and two children, 12 and 5.

"In my 45 years in law enforcement, I can't recall another incident so cold-blooded and cowardly," Hickman said.

Sheriff’s office spokesman Deputy Thomas Gilliland said Goforth had traveled to the Chevron station where the shooting happened, after responding to a routine car accident.

“He was pumping into his vehicle, and the male suspect came up behind him and shot the deputy multiple times,” Gilliland told the Houston Chronicle. “The deputy fell to the ground, the suspect came over and shot the deputy again multiple times as he lay on the ground.”

Fox affiliate KRIV reported Goforth was shot once in the head and three times in the back.

The Texas Department of Public Safety and the Houston Police Department were also involved in the search for the Miles.

"This is a very tough moment right now for the Harris County Sheriff’s Office," Gilliland said. "Keep us in your prayers and in your thoughts."  

"Bob Goerlitz, president of the Harris County Deputies Organization, said the incident was "shocking."

“We've been warned of things like this, because of public sentiment nationally and events over the last few years ... It's just horrific. That's the only way to describe it."

Click for more from KRIV.

The Associated Press contributed to this report.