Jaspal Ghai, Associated Press
Relatives gather outside a hospital in Himachal Pradesh on Sunday where victims were taken after a temple stampede.

NEW DELHI — Nearly 150 pilgrims, many of them children, were trampled to death at a Hindu temple in northern India on Sunday, after rumors of a landslide set off a stampede, local officials said.

Thousands of pilgrims had traveled to Naina Devi, a hilltop temple in the state of Himachal Pradesh, for a festival celebrating a Hindu goddess.

A long line of pilgrims had formed along a stepped path leading up to the temple in the morning when heavy rains began. Many then tried to take shelter in a covered area, local officials said. At that point, according to witnesses, rumors that boulders were beginning to roll down the hillside led to panic in the crowd, and people began running downhill into those gathered to avoid the rain.

"Because so many pilgrims were gathered at the shelter, the way up and down was blocked," said Suresh Kumar, a spokesman in the police control room at the temple. "When pilgrims started pushing down and the way was very crowded, the stampede took place."

Metal guardrails meant to protect visitors from steep drops were knocked down by the crowds, sending some people tumbling down the hillside to their deaths.

B. Purusharth, the deputy commissioner in Ropar, a city in Punjab state where many of the pilgrims were from, said at least 145 people died and 27 were injured. Officials estimated that about 50 of the dead were children, many of whom had been separated from their parents by the crush.

This was not the first time that overcrowding and panic had led to a stampede during a Hindu pilgrimage. Last October, 15 people were killed and 48 were injured at a railway station in a stampede of pilgrims traveling to the city of Varanasi to bathe in the Ganges. In 2005, a fire and stampede at the Mandhar Devi hilltop temple in western India left more than 250 dead.

As wealth grows among India's middle class, there has been an increase in domestic travel, including trips to temples and other religious sites. As a result, overcrowding, particularly during religious festivals, is becoming more common. In addition, many of India's hilltop temples can be reached only by narrow and treacherous paths, and the infrastructure surrounding them does not support the volume of visitors.

At this time of year, tens of thousands of pilgrims a day travel to the Naina Devi temple for a nine-day festival. Indian officials estimated that on Sunday, despite the heavy rains, 20,000 to 25,000 pilgrims had gathered at the temple.

The Himachal Pradesh government said Sunday that it would pay 25,000 rupees (nearly $600) to the family of each victim, according to local television reports.

It also said it would investigate the cause of the stampede and take action to prevent such problems in the future.