Prince George's County Fire/EMS workers rescued a homeless man who climbed into the ventilation duct of a Laurel Jerry's Subs and Pizza in search of shelter early Thursday morning and got stuck there for eight hours, authorities said.

A manager who came into the restaurant about 9 a.m. saw the man’s feet dangling above the stove and called police, authorities said. The man told firefighters and detectives he had entered the duct through the roof eight hours earlier, hoping to use the restaurant in the 9700 block of Fort Meade Road as a place to sleep for the night, authorities said.

“I was surprised,” said Mamah Rabietou, the manager who found the man. “I didn’t see the person, only the feet.”

The man, who authorities described as in his late 20s or early 30s, made it down the duct, but just above the restaurant’s stove, he encountered a row of closely spaced metal bars, said Mark Brady, a Prince George’s County Fire/EMS Department spokesman. The bars allowed only his feet to poke through, and he was unable to climb back out, Brady said.

Rabietou said she knew the man as a homeless person who lived in the area. Brady said firefighters arrived to the scene some time after 9 a.m. and called for specialized rescue units to free him. Those rescuers cut away the bars that lined the duct and took him to the hospital shortly after 10 a.m., Brady said. The man was complaining of chest pains and difficulty breathing, though he is expected to be OK, Brady said.

Cpl. Erica Johnson, a Prince George’s County police spokeswoman, confirmed that the man was homeless and that he told detectives he had entered the ducts in search of shelter inside the restaurant. She said he will be charged with breaking and entering once he is released from the hospital and officers can process him through the district court commissioner’s office.

This post has been updated.