A Texas man died from his injuries Monday one day after being handcuffed in the back of a police car and managing to pull out a gun from his waistband to shoot himself.

Zachary Khabir Anam, 19, died at University Medical Center-Brackenridge, Austin police said in a statement.

Anam was taken into police custody Sunday at the Barton Creek Square shopping mall at around noon. He had been detained on suspicion of shoplifting and carrying a controlled substance.

Interim police Chief Brian Manley said Anam was handcuffed and placed in the back seat of a patrol for the ride to police headquarters.

During the ride over, Anam managed to reach for his weapon on the right side of his pants. He pointed the weapon at his own head with threats to shoot himself, Manley added.

The police officer who was driving stopped the car and ordered Anam to drop the weapon. The unidentified officer and Anam went back and forth with threats and demands for about six minutes when Anam turned the gun on himself, Manley said. The ordeal was recorded on the dashboard camera.

According to Fox 7 Austin, the entire scene took place in front of a crowded bar.

"The officers were trying to get the people a safe distance away from the scene while actively handling what was happening," Manley said.

An Austin police spokeswoman wouldn’t say whether Anam was searched thoroughly for weapons, and Manley added that would be a focus of the internal investigation being conducted Monday.

Even if the suspect had been searched and handcuffed previously by private mall security officers, Austin Police Department policy holds each officer responsible for searching each person taken into custody for weapons.

Anam had run afoul of the law previously. In April 2016, he was arrested on a drug possession charge in Buda, about 15 miles southwest of Austin. That case remained open. At the end of May 2016, Austin police issued a warrant accusing him of engaging in organized criminal activity involving a string of burglaries and auto thefts. The warrant hadn't been served yet.

The officer who had custody of Anam has been on the force for 11 years.