A floor collapsed onto two Chicago firefighters early Tuesday as they were helping battle a residential fire, trapping one of them until he was rescued, officials said.

Crews arrived at the townhouse about 4 a.m. on the city's far South Side to find flames shooting from the building's roof. As firefighters were fighting the fire, the building's second floor collapsed, trapping the two firefighters and prompting a mayday response, the Chicago Fire Department said.

"That collapse happened awful quick," District Chief Jim McDonough told WGN-TV.

TAYLOR KINNEY TAKES LEAVE OF ABSENCE FROM 'CHICAGO FIRE' TO 'DEAL WITH A PERSONAL MATTER'

He said the two firefighters were within 10 feet of the townhouse’s front door when the floor collapsed. McDonough said one firefighter was able to free himself from the debris, but the other was trapped about waist-deep by debris before being rescued as firefighters continued fighting the blaze.

Illinois Fox News graphic

Two Illinois firefighters were trapped when the floor above them caved in. One of them was rescued while the other escaped on his own. Neither of them appeared to sustain serious injuries. (Fox News)

The two firefighters hit by the floor collapse were taken to a hospital along with two other firefighters. The fire department said all four appeared "to not be seriously injured."

CLICK HERE TO GET THE FOX NEWS APP

A resident in the building declined medical attention at the scene, officials said.

The fire was put out shortly before 5 a.m., but firefighters continued to extinguish hot spots throughout the building in Chicago's South Deering neighborhood.