The incident triggered near riots as a violent mob assaulted the train driver, set trains on fire and held railway staff hostage for a while, prompting appeals for calm from both Prime Minister Manmohan Singh and state Chief Minister Nitish Kumar.
Those killed were mostly kanwarias or devotees of Lord Shiva, who were crossing the tracks to visit a popular Shiva temple at Katyani Sthan, a religious stopover.
They had exited another train when the Rajyarani Express train from Saharsa, travelling at a speed of 80 km/hour on its way to Patna, crushed them. Reports said the driver tried to brake on spotting people on the tracks, but it was too late.
The Railways confirmed 28 deaths.
"It is the rarest of rare incidents," said the Chief Minister, who ordered post mortems to be conducted on the spot.
A 2012 government report said almost 15,000 people are killed every year crossing rail tracks, due to poor safety standards in remote areas.