The Parker County Sheriff's Office just released security camera footage of the June 23 incident.
The inmates were in a minimum security holding room in the basement of a district court building, Capt. Mark Arnett with the Parker County Sheriff's Office told CNN. That's when an officer experienced a medical emergency.
As he chatted with inmates in the cell, he suddenly slumped over in his chair and became unresponsive, Capt. Arnett said.
The group approached the holding cell door, looking at the officer, wondering what to do. They wanted to help, but they knew breaking out of the cell could land them in deeper trouble.
After a few seconds, though, they forced the door open. About five inmates stepped out of the cell, security camera footage showed.
Some checked on the officer, while others banged on doors and walls, yelling for help.
They tried shaking him to wake him up -- even grabbing his radio to try to call for assistance, the captain said.
But the officer had no pulse. He was not breathing.
The commotion in the basement eventually caught the attention of the sheriff's deputy and another corrections officer in other parts of the building.
They called for emergency personnel who shocked the officer with a defibrillator and stabilized him.
Capt. Arnett said he "absolutely" credits the inmates with saving the officer's life, especially considering it all happened within two minutes.
The inmates were locked back in the cell, with a thank you and no additional charges.
They will still be processed for their previous offenses, which include assault and drug charges.