A man accused of shooting three Texas officers has died from an apparent “self-inflicted gunshot wound” after a standoff that lasted over five hours, law-enforcement officials announced Tuesday.

Five agents with the Fugitive Apprehension Unit -- part of the state attorney general's office -- and two investigators with the sheriff’s office were attempting to serve a felony warrant to 25-year-old Daniel Trevino at approximately 12:50 p.m. local time, Chief Deputy Edison Toquica with the Harris County Sheriff’s Office said.

While at the door of the home, Trevino fired at officers who then returned fire, Toquica said during a news briefing earlier.

One deputy and two AG's officers were injured during the shootout.

Trevino barricaded himself inside the home for over five hours, police said.

During that time law enforcement was able to establish multiple lines of communication with Trevino.

Toquica said the suspect agreed to come out but instead fired at officers three more times.

He said at approximately 6:15 p.m., police discovered that Trevino died from a “self-inflicted gunshot wound to the head.”

“We work hard every day to be sure that these type of situations end in a peaceful manner,” Toquica said at a later news conference. “Today was an exception to that.”

TEENS 'SEVERELY' HURT AFTER FALLING OFF BORDER WALL, U.S. SAYS

He extended his “thoughts and prayers” to the injured officers who are expected to survive, adding that they are facing a “long recovery.”

One officer with the AG’s office was shot in the torso and leg while the other was shot in the foot, The Houston Chronicle reported. The deputy was struck in the hand and likely will lose a finger as a result of his injury, the news report said.

DOUBLE-MURDER SUSPECT WHEELED INTO COURT SCREAMING 'GOD'

The attorney general’s office released a statement confirming the injuries but declined to give further information.