A fire that tore through a Bronx building, killing at least 12 people in one of New York City's deadliest blazes in decades, was started by a child playing with a stove, fire officials said Friday.

New York Fire Commissioner Daniel Nigro described how Thursday night's inferno raced up the five-story building's stairs "like a chimney," quickly trapping those on the floors above. Some victims died from burns, others from smoke inhalation, he said, as the fast-moving blaze gave them little time to react — or find a main escape route out.

Among the dead were five children, including a one-year-old girl. The oldest victim was a 63-year-old woman, officials said.

Fourteen others were hurt, including four critically injured who are fighting for their lives, the officials added. Six firefighters and an emergency responder tackling the fire in frigid conditions were among the injured.

A 3-year-old boy with a "history of playing with the burners and turning them on" caused the fire, Nigro told reporters. Before his mother knew it, he said, "this fire had gotten a good hold of the kitchen."

The commissioner added that the mother of the child was in her apartment at the time, but not attending to the boy. By the time she discovered the flames, it was too late.

"She exited her apartment with her 2-year-old and 3-year-old, and left the door open, so this fire quickly spread up the stairs," Nigro said.

The lesson, he added: "Close the door, close the door, close the door. If unfortunately you do have a fire in your apartment, you must close the door when you exit because the results if you don't are what happened here last night."

Firefighters were on the scene within minutes, Nigro said.

New York Mayor Bill de Blasio called the city's worst fire in a quarter-century "an unspeakable tragedy."

"In the middle of the holiday season, a time when families are together, tonight here in the Bronx there are families that have been torn apart," the mayor said. "Based on the information we have now, this will rank as one of the worst losses of life to a fire in many, many years."

Emelia Ascheampong, right, a resident of the building where at least 12 died in a fire, is embraced by a friend on Dec. 29, 2017. Ascheampong, her husband Nana, and four children, survived the fire by using a fire escape.Andres Kudacki / AP

The fire happened just before 7 p.m. ET Thursday at the residential building near the Bronx Zoo. Children without coats huddled on fire escapes as firefighters worked through icy conditions to bring the flames under control in about two hours.

"By the time I got downstairs, the fire had already escalated from one apartment to two, two to almost three. All I see is a bunch of kids on the fire escape, cold, with no jacket, no pajamas, no nothing," said Rafael Gonzalez, who lives across the street.

Betty and Joel Rodriguez, who lived on the first floor of the apartment building opposite the unit where the fire started, said they escaped after smoke came pouring into their apartment.

"I opened the door; all I saw was black smoke so the next thing ... I yanked the A/C out of the window, threw it on the sofa, had my wife get out, and another person that was with us and an emotional support dog to get out," Joel Rodriguez told NBC New York on Friday. "They are fine right now."

He said he saw neighbors being carried out and "just started crying" when the extent of the destruction sunk in.

Maria Bonilla, who lives a block away, was outside waiting to hear word on a friend's 8-month-old child.

"There was a lot of people coming out in stretchers, burned," she told reporters at the scene. "There was fire, really bad fire. It was crazy."

Earlier, Nigro said victims were found on various floors of the building, which has 25 apartments. He added that it's not unusual for children to be fascinated by fire or rare for children to start them.

Diallo said the apartment building has tenants who hail from all over the world.

Many questions remained in the immediate aftermath of the blaze, including how the fire spread so quickly in a brick building that was built after catastrophic fires at the turn of the 20th century ushered in an era of tougher enforcement of fire codes.

Firefighters work at the scene of an apartment fire in the Bronx, New York on Thursday.Amr Alfiky / Reuters

The building was not new enough that it was required to have modern-day fireproofing, like sprinkler systems and interior steel construction.

Nigro said Friday that it wasn't yet known if all the apartments' smoke alarms were working.

Witnesses on Thursday night described seeing burned bodies being carried away on stretchers and young girls who had escaped standing barefoot outside with no coats.

Twum Bredu, 61, arrived in the neighborhood looking for his brother, who had been staying with a family in the building. The family, a husband and wife and four children, got out. But there was no word about his brother.

"I've been calling his phone, it's ringing, but nobody picks up," Bredu said. "He was in his room, and we don't know what happened."