Both officers were injured in the gunfight, and one later died of his injuries, officials said. Their names weren't immediately released.
The officers were members of the Killeen SWAT team, and were attempting to negotiate with a man who had barred himself inside his apartment after threatening people by the pool.
Officers found him "holding a long rifle in a threatening manner," police said.
He put down the gun and began to walk out of his apartment with his hands raised, but then backed up and grabbed the rifle when police tried to arrest him.
He fired, hitting two officers before being killed by other members of the SWAT team returning fire.
Police did not immediately identify the suspect.
The surviving officer underwent surgery at Scott & White Hospital in Temple, Texas to treat the gunshot wound to his leg.
“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. Our hearts and prayers go out to the officer’s family during this difficult time” said police Chief Dennis Baldwin.
City records said the last time a law enforcement officer in Killeen was slain in the line of duty was in 1917, when town marshal John Blair was shot while trying to stop a shootout between a father and son.
Iranian woman stops the execution of son's killer
Disney's 'Jessie' to feature network's first engagement