A Texas police officer who made headlines for being one of the first to wear traditional articles of faith as part of his uniform was killed during a routine traffic stop on Friday.

Sandeep Singh Dhaliwal, a sheriff’s deputy in Harris county, which includes Houston, died after a suspect appeared to ambush him and shoot him in the back of the head.

The alleged shooter, Robert Solis, 47, was arrested and charged with capital murder. Although it was not immediately clear what punishment prosecutors would seek, Texas is a death penalty state.

“I’m sad to share with you that we’ve lost one of our own,” Harris county sheriff Ed Gonzalez said on Twitter. Dhaliwal “was unable to recover from his injuries”, he said.

“There are no words to convey our sadness. Please keep his family and our agency in your prayers.”

Dhaliwal was shot about 12:45pm on Friday. Footage from a dashboard camera showed him having a conversation with the driver, then walking back toward his squad car. The driver’s door swung open and he ran up behind Dhaliwal and shot him, the Houston Chronicle reported.

Officers escort the body of deputy Sandeep Dhaliwal, who was shot and killed after a traffic stop on Friday. Photograph: Jon Shapley/Associated Press

Dhaliwal, 42, had worked at the sheriff’s office for 10 years, starting as a detention officer in his late 20s. He was promoted to a deputy in 2015. He had three young children and was a practising Sikh.

Dhaliwal made national headlines when he was granted permission to wear a turban and beard as part of his uniform in one of America’s largest sheriff’s offices.

“Sandeep was a trailblazer for the Sikh-American community,” Bobby Singh, south-east regional director for the Sikh American Legal Defense and Education Fund, said on Twitter.

“He served not just the Sikh community here in Houston with honor and dignity, but all of his community.”

Amanda Williams sent us these photos & message.

"My son, Connor, met Deputy Dhaliwal at the Goforth memorial. They were smitten with one another from the moment they met. He was such a wonderful man. Such a tragic loss."

Houston is in mourning -> https://t.co/kCuqauuWE4. #abc13 pic.twitter.com/7aArx9Ke5w — Steve Campion (@SteveABC13) September 27, 2019

Houston mayor Sylvester Turner called Dhaliwal “a bold and groundbreaking law enforcement officer in the eyes of our county, our state, our nation”. Texas senator Ted Cruz said the state was “mourning a hero”.

The turban is a traditional sign of faith for Sikh men, which typically covers uncut hair and is worn with a long beard. According to the Sikh Coalition, a civil rights group, a turban is “a public commitment to maintaining the values and ethics of the tradition, including service, compassion, and honesty”.

In 2012, Washington DC became the first major US police force to make explicit accommodations for Sikhs to preserve their appearance on duty. An estimated 500,000 Sikhs live in the US as a whole.

Dhaliwal tried to fit into American culture when he was young by shaving his beard and removing his turban, he told India Abroad, an Indian-American news weekly. He was once told he could only mop floors because of his poor English, the outlet reported.

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

“I found it very insulting, and decided I will work overtime on my education and my English,” Dhaliwal said. He later started a trucking business, according to CBS.

Dhaliwal changed careers in his late 20s and took a “huge pay cut” to join the sheriff’s department, Gonzalez told India Abroad.

Permission to wear his articles of faith took time to wind through the department but was eventually made possible by a formal police department policy.

Dhaliwal said the permission to wear his turban and beard “was a very American thing to do. You can be a good American and you can practice freely your religion.”

According to India Abroad, the same day it was announced Dhaliwal could wear his articles of faith, he was given the day off. Instead, Dhaliwal went to work, to show his new uniform to his colleagues.