Late Friday, deputies identified 47-year-old Robert Solis as one of the suspects.
Early Saturday morning Solis was charged with capital murder. The judge set no bond at his first court hearing.
"The nature of the allegations involved in this case and the manner at which the murder was carried out indicate to me that Mr. Solis is in severe and immediate danger to the community at large," the judge said.
Sheriff Ed Gonzalez said Deputy Sandeep Dhaliwal "was unable to recover from his injuries" after he was shot in the back of the head during a traffic stop in northwest Harris County.
READ MORE: 'Pioneering' deputy dies after being shot from behind: sheriff
Prosecutors say Solis and his passenger told investigators Deputy Dhaliwal pulled them over for running a stop sign.
Dash camera video shows Dhaliwal walk away from the suspect's vehicle, back towards his own. That's when police say Solis can be seen getting out of his car and running towards him, firing his gun several times.
According to Harris County Sheriff's Office Maj. Mike Lee, deputies immediately checked the dash cam video inside Dhaliwal's unit to get a closer look at the suspect when they arrived on scene.
Lee says the suspect was found inside a business about a quarter of a mile away from where Dhaliwal was shot.
"A deputy observed that he looked a little nervous and put him in custody, and that did turn out to be our shooter," Lee said.
Lee adds the weapon believed to have been used to shoot Dhaliwal was recovered in the parking lot of the business.
It was revealed in court early Saturday morning that Solis was caught on surveillance video trying to throw away the Glock 45 caliber semi automatic gun used in the murder.
Officials say Solis called friends after the shooting and told them he just shot a deputy and needed to be picked up.
"I believe it was a suspect, he has a lengthy criminal history, on parole, probably knew he was going to go back to jail and did not want to go back to jail," said Lee when asked about a possible motive. "It was senseless."
Solis has an extensive criminal history. He has been a wanted fugitive since 2017 for violating parole on a charge of aggravated assault with a deadly weapon.
He also has past charges for aggravated kidnapping, aggravated robbery and driving while intoxicated.
A woman, who is believed to be a passenger in the suspect's car, was also detained and placed into custody.
"It was a total ambush by the suspect," Lee said. "The deputy never had a chance."
The sheriff's office has not released the woman's name.
Deputy shooting timeline: What we know about what happened
Follow Mycah Hatfield on Facebook and Twitter.