A group of Georgia inmates are being praised for their heroic actions after they helped save an officer who had suddenly collapsed on duty, authorities said.

The six Polk County jail inmates were doing field work in a remote area outdoors on Monday when the deputy sheriff who was supervising them fell face-first on the ground, Polk County Sheriff Johnny Moats said. The inmates could have left the officer behind and escaped in his van, but instead they stayed and helped.

“They could have taken the gun, got the work van and gone,” Moats told TIME. “They could have done anything they wanted. They were out there by themselves with this one officer. If they would have left him there, it could have been hours before anyone came across him.”

Instead, all six prisoners rushed over to the deputy sheriff, who had collapsed due to the extreme humidity and a previous medical condition, Moats said. They immediately called 911 on the officer’s cellphone and pulled off his vest to try to keep him cool until help arrived.

“They stayed right there with him,” Moats said. “If he didn’t have any help, I don’t know what would have happened to him.”

The deputy sheriff has recovered and is already back at work, authorities said Tuesday. He had only been working the outdoor detail with the six inmates for about five months, according to Moats. The inmates are paid by the city to cut grass at a cemetery, which is where they were when the deputy collapsed. Moats said the inmates were all jailed for minor criminal offenses.

The inmates’ rescue of the officer came just days after the end of a three-day manhunt for two other Georgia inmates who had killed two prison guards before escaping. Moats said he realizes Monday’s incident could have ended in tragedy. “The inmates did a really good job,” he said. “I’m extremely proud of them.”

The sheriff’s office rewarded them with desserts and pizza in the park.

One of inmates involved told local TV station WXIA that the group knew they had to do the right thing. “When that happened, in my opinion, it wasn’t about who is in jail and who wasn’t,” Greg Williams said. “It was about a man going down, and we had to help him.”

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.