Two people were killed and 17 others were injured when a three-story apartment building collapsed in Brooklyn on Wednesday afternoon, and firefighters were still digging through the rubble late into the night searching for anyone trapped beneath it.

The four-unit building, dating from 1930, collapsed at about 4 p.m. on Flatbush Avenue in the Flatbush neighborhood, near Newkirk Avenue, tumbling into an adjacent construction site where excavation work was underway. The Fire Department received the call at 4:01 p.m., and a firefighting crew that happened to be nearby arrived within a minute.

New York City officials said 19 people were treated in total, including the two who died. Four people were taken to hospitals in critical condition, 12 were in stable condition, and one firefighter was treated for minor injuries. Seven children were among the victims. At least four survivors were pulled from the wreckage about two to two and a half hours after the collapse, including a pregnant woman.

More than 250 firefighters and emergency medical workers responded, aided by search dogs, removing debris by the bucketful as they combed the ruins for signs of life. Fire Commissioner Lillian Bonsignore said at an evening news conference that officials did not know how many people were still in the collapse zone, and Fire Chief John Esposito said it would take rescue teams several days to clear the entire site.

Mayor Zohran Mamdani said at the scene that the number of victims was likely to rise. He announced that the city's Department of Buildings and law enforcement would investigate the cause of the collapse. Buildings Commissioner Ahmed Tigani said construction crews had been excavating the site next door when the building crumbled into it, trapping residents and workers underneath.

The cause of the collapse remained under investigation late Wednesday, and Flatbush Avenue was closed around the site as the search continued.