Prince George’s County Police Officer Edwin A. Flores was on his way home from the gym when he saw four armed men about to carjack an elderly woman in a Gaithersburg parking garage. He stopped them by himself, then realized he had left his cell phone in the car and would need to borrow one from the suspects to call for backup, authorities said.

Flores was one of 31 Prince George’s County police officers, firefighters and other public safety employees honored at the annual Medal of Valor awards ceremony in Greenbelt Wednesday. The awards honor acts of heroism — including many that occur when the recipients are off-duty.

Flores was given a gold medal of valor “for his bravery and willingness to place himself in extreme danger” in connection with the October incident, officials said in a document detailing the awards. Police eventually arrested all four suspects and recovered four weapons, authorities said.

“I knew something bad was about to happen if I didn’t do something, so I had to take action,” Flores said. “As a police officer, you go through so much training, you really don’t think about the fear or the risk you’re taking.”

Among the other award recipients:

Prince George’s County Fire/EMS Capt. James M. Jiron and volunteer firefighter Justin Eric Davidson were honored with bronze medals of valor for making off-duty rescues when fires broke out while they were visiting relatives.

Prince George’s County Police Lt. Edward S. Finn and Capt. Jason P. Bogue were honored for their roles in confronting an armed gang member who was driving a stolen car and carrying a large amount of PCP in January 2010. Authorities said the suspect led police on a car chase, crashed on Pennsylvania Avenue and fired at Finn. Finn had to kick a gun out of his hand before officers could move in and arrest him. Finn received a silver medal of valor; Bogue received a bronze medal.

“I did everything that I could, humanly possible, not to shoot somebody,” Finn said, though he added that officers had exchanged fire with the suspect before he was able to ambush the suspect and kick the gun loose. “I completely caught him off guard. He was so fixed on where I was moments earlier.”

Dispatch aide Katrina Boseman and dispatcher Linda Shegan were honored for their roles in helping police locate a man thought to have killed his estranged wife and left her body in a car in February 2010. Shegan, a shift supervisor, called the suspect’s cell phone and got his location after his mother called to report her son had slain his wife and was threatening to kill himself. She was honored as dispatcher of the year. Boseman, who took the mother’s call, was honored as dispatch aide of the year.

Cpl. Thomas P. Jensen was honored for racing to respond to a call in February about a man who had begun fighting with firefighters after throwing a cinderblock through a woman’s apartment window. On his way to the scene, Jensen hit a patch of ice on Baltimore Avenue in College Park and crashed into a pole. He died from his injuries about a week and a half later. Jensen was posthumously named officer of the year and awarded a gold medal of valor.