A suspect has been taken into custody after a police officer in San Marcos, Texas, was shot and killed Monday afternoon while he was serving a warrant, authorities said. 

Officer Kenneth Copeland, 58, a veteran who has been with San Marcos Police Department since March 1998, was working on his day off and serving a warrant in the El Camino Real sub division when he was fatally shot at 2:23 p.m. EST, police chief Chase Stapp confirmed during a press conference Monday night. Copeland and other officers present were shot at by the suspect, "much like in an ambush type of situation."

Copeland, who was wearing a protective vest, was struck several times. He was rushed to the Central Texas Medical Center immediately and was later pronounced dead around 3:50 p.m. EST, police said. The shooting was said to have occurred near Bowie Elementary School in Texas.

"Ken is a hero," Stapp said during the press conference. "Today was his day off. He worked just about every day off to provide for his kids and because he knows that we're short-handed and need the help. His picture is hanging in different parts of this police department because everyone here loved him," according to ABC affiliate KUVE.

"I want to offer my thanks to all of the members of the Central Texas Medical Center who tried very hard to save Ken's life," chief Stapp added. "They are a part of our family as well and they did a great job."

A suspect was taken into custody after he surrendered to law enforcement following the shootout. The suspect was also shot at during the incident and was taken to a hospital in Austin, police said. However, it was unclear if he was injured from a self-inflicted wound or the police gunfire.

Copeland is the first officer to be killed in the line of duty in the history of the San Marcos Police Department, Stapp added. He is survived by his wife and four children, according to Dallas News.

Texas Gov. Greg 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."

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

Attorney General Ken Paxton said in a statement 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."