Firefighters have freed a man who somehow became stuck in a narrow space between two buildings in the Moss Park area for hours Tuesday night.

The man was finally freed from his ordeal after being stuck in a tiny space for more than five hours.

The buildings are located on Sherbourne Street, between Queen and Richmond streets and firefighters said the gap was extremely narrow.

“The space he’s occupying is no more than eight inches wide,” Platoon Chief James Green told CP24 as the rescue was underway.

Toronto Fire said the man had been stuck since the early evening and appeared to be too weak to grasp at ropes that were thrown his way.

“He’s got some lack of circulation in his arms and legs so he can’t really move,” Green said. “He’s got a rebar that’s wedged around his legs. He’s in a bit of a state, that’s for sure.”

It’s not clear how he became stuck, but it’s thought that he may have ventured inside the space to try and retrieve something.

Rescue workers cut through a wall to try and reach him and had to bring in a jackhammer to try and break through other walls.

“We’re actually breaching a hole through one of the walls just in front of the man and from that point our crews will be able to get hands on him, ropes on him and hopefully pull him to safety without hurting him any more than he’s already hurt,” Green said.

“It’s an extremely difficult operation. We’re jack hammering through three layers of brick in a close environment.”

The rescue took around two and half hours, during which crews were in constant contact with the man and gave him water to keep him hydrated.

He was eventually removed from the space through a hole cut in one of the walls and was taken to a waiting ambulance to be assessed.

Toronto Paramedic Services said the man was in serious but non-life-threatening condition, with decreased awareness and a number of aches and pains.

A section of the street was blocked off as firefighters worked to free the man.