(CNN) -- A man accused of shooting and killing a pioneering Texas sheriff's deputy during a traffic stop was wanted at the time, and that may help explain why the shooting happened, authorities say.
Robert Solis, 47, was arrested Friday, shortly after police say he killed Deputy Sandeep Dhaliwal, an observant Sikh who years ago gained national attention when he got permission to wear a turban as part of his Harris County Sheriff's Office uniform.
Dhaliwal had just stopped Solis for a traffic violation and walking back to his patrol car Friday afternoon when he was shot twice, including at least once in the back of the head, authorities said.
At the time of the traffic stop, Solis was wanted on a parole violation warrant, Sheriff Ed Gonzalez said on Twitter.
Authorities haven't said what Solis allegedly did to have violated his parole. Solis has been out of prison on parole since 2014, 12 years after he was convicted in Harris County of aggravated kidnapping and aggravated assault with a deadly weapon, court records show.
"He (Solis) ... probably knew he was going to go back to jail and did not want to go back to jail," sheriff's Maj. Mike Lee said Friday, according to CNN affiliate KTRK, when asked about a possible motive.
It wasn't immediately clear what, if anything, Dhaliwal knew about the warrant.
Solis is charged with capital murder. A judge ordered Solis held without bond at a probable cause hearing Saturday morning. His next court appearance is scheduled for Monday.
A woman who was in the vehicle with Solis was also taken into custody. It wasn't immediately clear if she was facing charges.
"This guy had a heart of gold," Adrian Garcia, Harris County police commissioner, said. "He treated his brothers and sisters in law enforcement as if they were just brothers and sisters. He thought of them before he thought of himself. He thought of the broader community before he thought of himself."
A funeral for Dhaliwal is scheduled for Wednesday. A Sikh religious ceremony will take place at 10:30 a.m. local time and a law enforcement ceremony will take place at 11:30 a.m., according to a tweet from the Harris County Sheriff's Office. The public is welcome to attend both ceremonies, it said.
Deputy's dashcam helped identify his alleged killer, authorities say
Dhaliwal's dashcam helped identify Solis as his alleged killer, investigators say.
The deadly encounter started as a regular traffic stop just before 12:30 p.m. CT in the Copper Brook area of northwestern Harris County, said Lee, the Harris County sheriff's major.
The dashcam video shows Dhaliwal speaking with the driver with "no combat, no arguing," Lee told reporters. The driver's door was open at one point as the deputy and driver were talking.
Dhaliwal shut the driver's door as the driver remained in the vehicle. As he turned to walk back to his patrol car, the driver's side door opened and a man exited the vehicle "almost immediately running with a gun already out," Lee said.
The dashcam captured the fatal moment Dhaliwal was shot from behind in the back of the head, Lee said.
"In a cold-blooded manner, ambush style, (he) shot Deputy Dhaliwal from behind," Gonzalez said. "It's the worst day, the worst nightmare for any police executive."
The shooter returned to his vehicle and drove away. A resident who was doing yard work nearby heard the gunshots and rushed to help the deputy.
Authorities identified Solis by looking at Dhaliwal's dashcam video. They took a photo of the suspect from the dashcam and immediately got it out, Gonzalez said.
Solis was arrested at an ice cream shop less than a mile from the shooting scene, authorities said. Solis had been there for nearly half an hour before he was taken into custody, CNN affiliate KPRC reported.
The pistol deputies believe was used to kill Dhaliwal has been recovered, the sheriff said.
Solis has been ordered to undergo a mental evaluation
Solis shot Dhaliwal "in the back of the head as he was walking away," in a "cold and cowardly manner," a prosecutor wrote in a court filing arguing for no bond.
Solis has been ordered to undergo a mental evaluation, court records show.
In 2002, he had been sentenced to 20 years in prison after his kidnapping and assault convictions.
He was released in 2014, and was to remain on parole until 2022, according to the Texas Department of Public Saety.
The deputy leaves a legacy as a trailblazer
Dhaliwal is survived by his wife and three children.
He leaves a legacy as a trailblazer for the department he served for a decade. He was the first member of the Sikh community to become a Harris County sheriff's deputy, officials said.
In 2015, roughly six years after Dhaliwal joined, the sheriff's office made an official policy that allowed him to wear his beard and turban on duty, according to CNN affiliate KTRK.
"As a Sikh American, I felt the need to represent the Sikh community in law enforcement," Dhaliwal said at the time. "It will give me the chance to open up the conversation."
Prior to becoming a deputy, Dhaliwal was an entrepreneur with a trucking business. He found out that the Harris County Sheriff's Office needed someone like him to build bridges with the Sikh community and sold his business. He took lower pay as a detention officer and worked his way up to be a deputy, Garcia said.
Dhaliwal represented the community's diversity and inclusiveness, Houston Mayor Sylvester Turner tweeted.
"He wore the turban, he represented his community with integrity, respect and pride and he was respected by all," Gonzalez said.
Sikhism is the world's fifth most popular religion. It is a monotheistic faith that believes in equality and service to others.
There are 25 million Sikhs around the world and about 500,000 in the United States, according to The Sikh Coalition.
A community mourns
In the hours after Dhaliwal's death, residents of the community he served gathered in an impromptu vigil and used social media to honor him.
Online, people shared photos and videos of their encounters with him. One woman sent the sheriff's office a video of Dhaliwal interacting with her deaf son at a restaurant.
"He laughed and joked with all of us and left a bright impression on my son who is deaf," she said, according to the sheriff's office, which tweeted the video.
People gathered Friday night at an outdoor, community-led candlelight vigil in the Copper Brook area, near where the shooting happened.
Gonzalez, the sheriff, stopped by.
"Grateful beyond words to witness the impromptu vigil," he tweeted.
™ & © 2019 Cable News Network, Inc., a Time Warner Company. All rights reserved.