Officer Kenneth Copeland. (San Marcos Police Department)

A veteran police officer in San Marcos, Tex., was shot and killed in an “ambush-style” attack Monday as he tried to serve an arrest warrant, marking the first time in the department’s history an officer was killed in the line of duty, according to the city’s police chief.

Kenneth Copeland, 58, was serving a warrant for a violent crime in a subdivision on the city’s south side when a man opened fire on him and other officers, “much like in an ambush-style situation,” Police Chief Chase Stapp said in an evening news conference.

Copeland, a 19-year veteran of the force who was working on his day off, was struck multiple times. His fellow officers put him in a patrol car and rushed him to the Central Texas Medical Center. He was pronounced dead shortly before 4 p.m.

The suspect, who was not identified, holed up in a house while officers on the scene called for backup and formed a perimeter around the area “in hopes of getting the assailant out peacefully,” Stapp said.

A crisis negotiation team arrived, and the suspect eventually surrendered and was taken into custody. He was shot at some point during the standoff, although police said it wasn’t clear whether he shot himself or was struck by one of the officers’ bullets. He was treated for the injury at a hospital in Austin, about 30 miles northeast of San Marcos.

City officials said Copeland was the first San Marcos police officer to be killed in the line of duty. They described him as a hard-working and well-liked member of the department and said he leaves behind a wife and four children.

“Ken’s a hero,” Stapp told reporters. “He worked just about every day off to provide for his kids and because he knows we’re shorthanded and need the help.”

“His picture is hanging in different parts of this police department because everybody here loved him,” he added.

Stapp said that Copeland, who served in the U.S. Coast Guard before becoming a police officer, was wearing body armor during the attack but that the bullets hit parts of his body that were unprotected. The chief declined to offer further details about the nature of the shooting or the arrest warrant Copeland was serving.

Texas Gov. Greg Abbott (R) offered his condolences to Copeland’s family and ordered the city’s flags lowered to half-staff in his honor.

“Today we grieve for the family of the fallen San Marcos police officer, and we vow swift justice for the killer,” Abbott said in a statement. “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.”

Four schools in the area were placed on lockdown following the shooting, and children who were boarding buses to go home were sent back inside, local media reported.

According to KXAN, Copeland was honored at a recent Cub Scouts program at one of the schools, Mendez Elementary. He also worked security at the Promiseland Church on the edge of town, Pastor Michael Higgins told the station.

“There’s a lot of great officers,” Higgins said. “There’s only a few that really mesh with our environment, and Ken Copeland was so highly respected.”

Copeland is the sixth law enforcement officer to die from gunfire in Texas this year, according to statistics from the Officer Down Memorial Page.

San Marcos Mayor John Thomaides called Copeland a “member of our family” and asked for the city to rally around men and women in law enforcement.

“No city is prepared for this, and we are all mourning together,” he said in Monday’s news conference. “This just rips your heart out.”

More from Morning Mix:

Christiane Amanpour named interim replacement for Charlie Rose on PBS

James Comey, Sally Yates and Eric Holder defend FBI after Trump’s Twitter attack