THIRUVANANTHAPURAM, India — A Hindu temple in southern India was packed with thousands for a religious festival early Sunday when fireworks began – an unauthorized pyrotechnic display that went horribly wrong.

Explosions and a massive fire swept through the Puttingal temple complex about 3 a.m. in the village of Paravoor, killing 102 people and injuring 380 others, officials said.

Scores of devotees ran in panic as the massive initial blast cut off power in the complex, while other explosions sent flames and debris raining down, a witness said. Many people were trapped inside.

“It was complete chaos,” said Krishna Das of Paravoor. “People were screaming in the dark. Ambulance sirens went off, and in the darkness no one knew how to find their way out of the complex.”

Das said the first deafening explosion occurred as the fireworks display was about to end and as he was walking away. It was followed by a series of blasts, he said.

The fire started when a spark from the fireworks show ignited a separate batch of fireworks that were being stored in the temple complex, said Chief Minister Oommen Chandy, the top elected official in Kerala state.

Most of the 102 deaths occurred when the building where the fireworks were stored collapsed, Chandy said. About 60 bodies have been identified so far, he said.

Das said six ambulances had been parked outside the complex as a precaution. They carried the injured to hospitals in the state capital of Thiruvananthapuram, about 37 miles south of Paravoor, as well as the city of Kollam. Villagers and police pulled many of the injured from under slabs of concrete.

TV channels showed huge clouds of white smoke billowing from the temple, as fireworks were still going off in the sky.