(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.

Robert Solis, 47, has been charged with the capital murder of Deputy Sandeep Dhaliwal. #hounews pic.twitter.com/ZGOzfEXqcc — HCSOTexas (@HCSOTexas) September 28, 2019

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.

Dhaliwal was known in the community, and his death has spurred impromptu memorials as well as online tributes from people recalling their encounters with him.

"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

Law enforcement officers saulte as Dhaliwal's body is taken to a medical examiner's facility Friday.

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.

There are 25 million Sikhs around the world and about 500,000 in the United States, according to The Sikh Coalition

A community mourns

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.

A Harris County resident sent us a video of fallen Deputy Sandeep Dhaliwal.



"He laughed and joked with all of us, and left a bright impression on my son who is deaf," she said.



Deputy Dhaliwal is an incredible loss not only to our HCSO family but to the entire community. pic.twitter.com/EbsdFeeWXO — HCSOTexas (@HCSOTexas) September 28, 2019

"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.

Community-led candlelight vigil was held tonight in honor of @HCSO_D5Patrol Deputy Dhaliwal. Please continue to keep his family & his @HCSOTexas family in your thoughts & prayers. Deputy Dhaliwal was LOVED by this community. #HouNews pic.twitter.com/oD7M78RXxm — Major Mike Lee (@HCSOPatrol) September 28, 2019

Gonzalez, the sheriff, stopped by.