BROOKLYN, N.Y. — Firefighters navigated a collapsed floor and roof to rescue a Brooklyn man from a fire that tore through a home in Midwood Wednesday morning, officials said.

According to the FDNY, the fire was reported just after 4 a.m. on East Ninth Street, between Foster Avenue and Avenue H.

The fire, which began on the first floor, quickly grew to a three-alarm blaze and engulfed both floors of the two-story home, department officials said.

As firefighters worked to contain the flames, the second floor eventually collapsed and the roof caved in. The Department of Buildings noted there was also substantial damage to adjacent structures.

FDNY officials said firefighters were able to enter the home and remove a 57-year-old man who was immediately transported to a nearby hospital in critical condition.

"Our members did a fantastic job under heavy clutter conditions to remove this individual. We had a collapse of the second floor into the first floor briefly pinning two of our members, they were quickly removed," FDNY Deputy Chief Joseph Duggan Jr. said.

More than 135 firefighters responded to the scene, and five were injured.

The flames were brought under control just before 6:30 a.m.

Department of Building officials said that vacate orders were issued to two neighboring buildings and residents have been offered emergency relocation assistance by the American Red Cross.

The cause of the fire remains under investigation.