A central Kentucky police officer died early Friday after he was shot in the head by a career criminal who vowed he was "not going back" to prison, investigators say.

Richmond Police Officer Daniel Ellis, 33, was shot Wednesday while searching an apartment for the robbery suspect, according to authorities. The officer died at the University of Kentucky Medical Center in Lexington.

Authorities said Ellis and another officer went to an apartment in search of a man who tried to mug a woman in the parking lot of a downtown gas station.

While there, police said the suspect, Raleigh Sizemore Jr., 34, shot Ellis in the head. The second officer returned fire and struck Sizemore, who was treated at the hospital and released to police custody.

Sizemore was charged with attempted murder of a police officer and unlawful imprisonment first degree.

Two others in the apartment during the shootout were also arrested: Gregory Ratliff, 25, was charged with complicity to commit murder, and Rita Creech, 44, was booked with robbery in the first degree.

A police report detailing the incident said Sizemore allegedly told Ratliff moments before the shooting that he had spent “half his life in prison and (was) not going back.”

Sizemore also allegedly told Ratliff to “not to let them in or he would shoot him,” the police report said, according to USA Today.

Sizemore then led Creech into a bedroom in the back of the apartment with a gun in his hand and Ratliff let Ellis in, allowing Ellis to search the apartment but claimed no one else was there and there were no weapons inside, the report said.

The report alleges that Sizemore opened fire on Ellis “as soon as he began to cross the threshold of the bedroom door.”

All three suspects are being held at the Madison County Detention Center.

"It's just heartbreaking," Richmond Mayor Jim Barnes told The Associated Press. "It's an emotional time for everyone in the community. Those guys work so hard to protect the city."

Ellis, a seven-year veteran of the force, had remained in the hospital after suffering life-threatening injuries following the Wednesday shooting.

Barnes said people in Richmond, which has a population of about 32,000 people, had already been talking about raising money for Ellis' family while he was in the hospital. Barnes said he is also concerned with how to better protect Ellis' colleagues who are still on the police department.

“He was always in a good mood, always had a smile on his face,” Richmond Police Maj. Steve Gregg said earlier this week, according to USA Today. “He was always eager to help his fellow officers. Police work is like a big brotherhood. And he was like everybody’s brother.”

Gregg said Ellis was on track to be promoted to detective early next year. The Officer Down Memorial Page, which describes itself as a non-profit organization dedicated to honoring America's fallen law enforcement heroes, said Ellis is the 106th officer to die in the line of duty this year and the fifth in Kentucky.

The Associated Press contributed to this report.