FREMONT -- A 44-year-old man who had been sleeping in a dumpster outside a Fremont restaurant managed to survive two cycles of compaction in a garbage truck Monday morning, police said, CBS San Francisco reports.

Fremont firefighters asked police for assistance for a medical call after the man climbed out of the garbage truck near Fremont Boulevard and Alder Avenue at about 6:45 a.m. Monday, police said.

Investigators learned that the man had been sleeping in the trash bin at a local restaurant when it was emptied into the garbage truck, according to police.

Get Breaking News Delivered to Your Inbox

The man was able to survive two cycles of compaction before deciding to climb out of the truck and jump down to the street, police said.

The man was transported to a hospital for a medical evaluation and was still there as of late Monday, according to Fremont police spokeswoman Geneva Bosques.

When officers learned the man's identity, they discovered there were several outstanding warrants for him but they don't plan to press charges against him at this time because a mental health hold has been placed on him, Bosques said.

The man, whose name isn't being released by police because of his mental health issues, "is very lucky to have survived," she said.