The fire department is investigating a fire that tore through several buildings in Queens overnight.

Flames broke out at a two-story building on Jamaica Avenue in Richmond Hill shortly before 1:30 Thursday morning.

The fire then spread to six neighboring buildings.

Three firefighters were taken to the hospital to be treated for injuries. About 40 people were forced from their homes and are being helped by the Red Cross.

Fire officials say the flames moved fast.

"It quickly extended to a common area that runs above the ceiling. Once it gets in there we have to get ahead of it. It's all wood structure, old, so that's the challenges," said Assistant Fire Chief John Hodgens.

The fire was declared under control around 3:45 a.m.

One man said he was "devastated" to find out some families have been displaced by the fire.

“It’s heartbreaking and you have to deal with this," he said. "Also, the people who live here, they have no home now."