A homeless man was nearly crushed inside a garbage truck in Brockton after the dumpster he was sleeping in was picked up.

Police said the man was sleeping inside the receptacle when the garbage truck picked it up and dumped it inside. Driver Billy Burt said he turned the compacter on to crush everything but then heard screaming. He found the man stuck inside and ran to a nearby business, where workers called 911.

"I could tell he was hurt. I asked him if he was injured and he just said, ‘I’m hurt.’ I told him to stay still and then climbed up on the side of the truck to keep the guy calm while the fire department showed up," said Burt.

The fire department came and freed the man from the garbage truck. The man suffered injuries to his hand and Burt said he is relieved that his injuries were not worse.

"I’m glad he’s out," said Burt. "I’m glad he’s alive because if I had made it down this way, it would have been a completely different story."

Police said they have warned the homeless not sleep in dumpsters because of the risk of this happening.

(Copyright (c) 2016 Sunbeam Television. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.)