Updated

A police officer in San Marcos, Texas, was shot and killed Monday afternoon when he was serving a warrant, police said.

Officer Ken Copeland, a veteran of the San Marcos Police Department since March 1998, was serving a warrant in the El Camino Real subdivison of the city when he was fatally shot, Police Chief Chase Stapp confirmed during a press conference Monday night.

Copeland — who was wearing a protective vest — and other officers were shot at by the suspect, "much like in an ambush type of situation."

He was taken to the Central Texas Medical Center immediately and was later pronouced dead at 3:50 p.m. local time, according to a press release from the city of San Marcos.

The shooting happened near Bowie Elementary School, Fox 7 reported.

A suspect is in custody after he surrendered to law enforcement following a shootout. The suspect was shot during the incident and was transported to a hospital in Austin, police said. It's unclear if the suspect was injured from a self-inflicted wound or if he was injured from police gunfire.

"Ken's a hero. Everybody here loved him," Stapp said, noting that Copeland's photo is hung throughout the police department.

Copeland was shot while working on his day off, the police chief added. "He worked just about every day off to provide for his kids."

Stapp said that Copeland is the first officer from the San Marcos force to be killed in the line of duty.

Texas Gov. Gregg Abbott tweeted the news, and said: "We pray for the family of the San Marcos police officer killed in the line of duty. We remember the sacrifices our men and women in law enforcement make every day. #BackTheBlue."

In a separate statement, the governor said, "Today we grieve for the family of the fallen San Marcos police officer, and we vow swift justice for the killer. The men and women in law enforcement put their lives on the line every day to protect and to serve our communities, and we will never forget their sacrifices."

He added: "Cecilia and I extend our heartfelt condolences to the officer’s family and to the entire San Marcos Police Department."

Attorney General Ken Paxton said in a statement that he's "deeply troubled and saddened" at the officer's death, and added: "Officers around our state courageously serve and deserve our utmost honor and respect, especially during this time. Please join Angela and me as we pray for the officer's family, the people of San Marcos, and for our law enforcement officers around the state."