Hornsby was shot early Sunday morning as officers responded to a 911 call about a man with a gun threatening neighbors in an apartment complex, the Killeen Daily Herald reported. The alleged gunman was killed by police gunfire.
The man's identity had not been released, but neighbors told the Herald he had recently returned from Afghanistan. Killeen, next door to Fort Hood, has a large military population.
Tenesha Dixon said the man told her husband earlier he had been drinking since 7 a.m.
"He liked to drink," she said.
Hornsby was the first Killeen police officer to be shot in the line of duty in 95 years, officials said.
"Early this morning, this community experienced the loss of one of Killeen's finest. The days ahead will be challenging, but for now, we are mourning the loss of a great officer," Police Chief Dennis Baldwin said in a statement. "Our hearts and prayers go out to the officer's family during this difficult time."
Another officer was shot and wounded.