SALT LAKE CITY -- A veteran Utah police officer who was shot to death Sundaywas working overtime to pay for his cancer treatments when he encountered a fugitive who went missing from a drug rehab center for parolees, officials said.

Unified police officer Douglas Scott Barney, 44, had been on the force 18 years when police say he encountered Cory Lee Henderson, 31, Sunday morning in a residential area near a church in the suburb of Holladay, about 8 miles southeast of downtown Salt Lake City.

Authorities say the incident began with a car crash involving Henderson and a woman in a BMW, when the two walked away from the wreck. Barney found Henderson nearby and the officer was shot in the head. Barney died hours later at a hospital.

Get Breaking News Delivered to Your Inbox

Other officers responded and exchanged gunfire with Henderson, who died at the scene.

Officer Jon Richey, 51, was shot once by a bullet that went through both legs. His condition was upgraded Monday to fair after he had emergency surgery, The Salt Lake Tribune reported.

Police said they were still searching for the woman who was with Henderson at the time of the crash.

The fatal police shooting is among the first on-duty officer deaths in the country for 2016 and the first ever for the Unified Police Department since it formed in 2010 to serve communities in the Salt Lake City area.

Barney, a married father of three teenagers, had volunteered to work overtime Sunday to help pay for his medical treatments after surviving bladder cancer, the Deseret News reported.

"His family has dealt with the possibility that they could lose their dad for 12 years, and he was in remission again and doing well," said unified police Lt. Lex Bell. "He was back to his old self, his color was good, and he was laughing and slapping you on the back again. And then they lose him to a bullet."

Bell, who was Barney's partner in the 2000s after both graduated from the police academy, told the Deseret News that Barney was a "boisterous, funny, caring, big old teddy bear of a man." He became a police officer after working at the Salt Lake County Jail because Barney wanted to help people and loved children.

Barney was serving as a school resource officer at Eisenhower Junior High School in Taylorsville when his cancer returned. Students in 2010 organized a dodgeball tournament to raise money for his treatment, which they called "Battle for Barney."

"I've always known these kids were great kids," Barney said in a KSL-TV story about the fundraiser. "They're watching over me."

Meanwhile, court records show Henderson was a troubled man with a history of drug abuse.

Henderson had multiple firearms and drug-related charges and had been sentenced to both federal and state prisons. Most recently, he had served 14 months after being convicted of possession of a firearm by a restricted person, and he was paroled in April 2015. His sentenced was shortened for the completion of a drug treatment program.

"Everything followed according to the guidelines, but it certainly is tragic that he decided to do this," Greg Johnson, spokesman for the Utah Board of Pardons, said to the Salt Lake Tribune.

Henderson violated the conditions of his parole and a warrant was issued for his arrest in June. He was arrested and went back to prison in October. Last month, he was ordered to a state-run parolee drug treatment center while court proceedings on new federal firearms allegations were pending. Within days, Henderson disappeared from the rehab facility, which allows parolees to make visits to school, work or to see family. A warrant had been out for his arrest since Dec. 21.