A group of Texas inmates broke out of jail, and their guard was happy they did when it emerged that they broke out to help him after he suffered a heart attack.

"It never crossed my mind not to help whether he's got a gun or a badge,"inmate Nick Kelton told WFAA-TV. "If he falls down, I'm gonna help him."

Eight prisoners were locked in a holding cell in a basement of the courts building in Weatherford, a small town near Fort Worth, when the lone guard there who had been joking with them suddenly slumped in his chair.

He just fell over," Kelton said. "Looked like an act. Could have died right there, man."

The inmates began yelling for help — even though they were worried they could bring nervous officers to the area with "guns drawn," said Kelton — but no one was near. One of the men managed to open the cell door and the group rushed to the guard, who had no pulse.

They kept up a ruckus to bring aid, and officers from the courtrooms finally burst in.

"They thought it was a fight," said inmate Floyd Smith. "They thought we were taking over."

Parker County Sheriff's Sargeant Ryan Speegle said he didn't know what to expect when he got downstairs. His worst fears seemed to be confirmed when he saw the inmates standing over an unconscious guard.

The guard "had keys," Speegle said. "He had a gun. It could have been an extremely bad situation."

The officers took the the men back to the cell, called 911 and started CPR. Arriving medics shocked the guard's heart, which started beating again.

Local Parker County Captain Mark Arnett said the breakout likely saved the guard's life. He has not been identified but is expected to return to work within a week.