An apparent gas explosion caused two residential apartment buildings to collapse and burst into flames, and two others to catch fire, injuring 12 people on Thursday in New York City's East Village neighborhood, authorities said.

Three of those people were critically injured, New York Mayor de Blasio told a news conference near the scene of the blast.

Preliminary evidence indicates it was a gas-related explosion, the mayor said.

He said gas and plumbing repair work had been underway in one of the buildings, and that Con Edison utility inspectors had been on the scene about an hour before the explosion and found the work did not pass inspection.

The blast caused two buildings to collapse, including the one where the explosion occurred, he said. Two adjacent buildings caught fire, he said.

First reports of the blast came in shortly after 3 p.m., officials said. The Fire Department declared it a seven-alarm blaze.

The buildings on Second Avenue at East Seventh Street are located in Manhattan's East Village, a neighborhood of small businesses, restaurants and apartments. Flames could be seen leaping high into the sky amid thick plumes of dark smoke.

Ben Mackinnon, 28, said he was drinking coffee in a cafe when he heard an explosion from across the street.

"The explosion was big enough that the door of the cafe blew open," Mackinnon said.

Outside he saw several bloodied men emerge from a sushi restaurant where the explosion appeared to originate, he said,

One of them fell to the pavement, Mackinnon said.

Shameem Noor, a cashier at the Veselka restaurant about a block away, said he too heard the blast.

"People were running and screaming," he said.