NEW DELHI — At least 43 people died, and a dozen more were injured early Sunday in a fire that swept through a small factory in India’s capital, police said. It was second-deadliest fire in Delhi history.

Rescue operations took nearly four hours and involved 30 fire engines and 150 personnel. The fire, reported at 5:20 a.m., broke out on the second floor of the five-story building. Atul Garg, chief of Delhi Fire Services, said the cause was not immediately clear as responders focused on the rescue.

Images shared by local media showed narrow corridors blackened with soot and charred materials. Police said most of the deceased were workers who lived in the factory, where they made school bags and purses. The majority were poor migrants from the state of Bihar.

“I saw bodies being taken in sacks,” said Sarfaraz Nabi, who runs an electrical shop nearby. “Police and rescue teams also carried some on their shoulders. It was a painful sight.”

Babur Ali, another neighbor, said locals rushed in to save people. “I went to the third floor to knock on doors, but the rooms were locked from inside, and people were fast asleep,” Ali said. “We ran out of the building for our lives.”

Garg said the factory was in a residential area in central Delhi near Rani Jhansi Road and had no provisions for fire safety. Congested lanes and dilapidated buildings with illegal manufacturing workshops dot the area where the accident took place.

Most of the victims succumbed to smoke inhalation, according to Sunil Choudhary, deputy chief fire officer. “The iron gate of the building was locked from outside,” he said. “The whole building became a gas chamber.”

Choudhary said officials were investigating the possibility the fire was caused by a short circuit.

There was chaos at the Lok Nayak Hospital as family members ran between the emergency ward and the mortuary in search of loved ones. Abdul Kareem, 35, heard of the fire and called his relative Mohammad Shakir, a worker at the factory, multiple times. Finally, he was directed to the hospital. “We have been waiting to hear from the doctors or anyone who could at least tell us if he is alive or dead,” Kareem said.

Mehboob Alam, 60, was waiting at the mortuary for news of two nephews. “My elder brother called me in the morning crying,” he said. “Imran had called his father scared that he would not survive.” By early evening, Imran’s body was found. Alam continued to search “hopelessly” for his other nephew.

Deadly fires are common in India, with fire safety regulations poorly enforced and illegal construction rampant. Small factories often operate illegally in cramped residential buildings without any safety measures in place. A fire at a Delhi hotel this year killed 17 people and prompted an outcry over fire safety measures in buildings in the capital.

Imran Hussain, a minister in the Delhi state government, called Sunday’s fire a “tragic incident.” He said an investigation will be conducted and action taken against those found responsible. Delhi’s chief minister, Arvind Kejriwal, visited the site and announced compensation to the families of the victims.

Delhi suffered its worst fire in 1997 when flames blazed through a movie theater during a screening, killing 59 people and injuring more than 100.