A fire on a train in Pakistan killed 73 people and injured about 40 when a cooking stove used by passengers to prepare breakfast broke, government officials said.

The fire destroyed three train cars near the town of Rahim Yar Khan in Pakistan's southern Punjab province.

The train was on its way from the southern city of Karachi to Rawalpindi, near the capital, and many passengers were traveling there to attend a religious conference.

"Two cooking stoves exploded when people were preparing breakfast, and the presence of kerosene with passengers increased the spread of the fire," Railways Minister Sheikh Rashid Ahmed told Geo TV.

"Most of the deaths were caused by jumping off the train," he said.

Television footage showed fire and black smoke coming out of the train's windows after stopping in fields.

A witness told Geo TV that the passengers were jumping off the train and the fire caught each other.

Jamil Ahmed, deputy commissioner of the region, told Reuters some of the bodies had been charred so they could not be identified. "I have ordered an investigation immediately," Prime Minister Imran Khan said in a tweet on Twitter.