At least 20 passengers fled from a train on to the tracks after a carriage caught fire on the outskirts of Bristol on Monday.
An investigation has been launched into the cause of the fire
The blaze on the 8.06pm Wessex trains service from Bristol Temple Meads to Weston-super-Mare burnt out one carriage and badly damaged a second.
Eyewitnesses said flames reached 20 feet into the air.
All the passengers escaped safely, but three people were treated for the effects of smoke inhalation.
The train came to an emergency halt half a mile from Nailsea and Backwell station in north Somerset.
British Transport Police said passengers and train controllers had called to report smoke on the train at 8.35pm.
Most of the passengers were commuters returning home to north Somerset.
Witness Andy Didlick said: "Before I knew what was going on I looked out of the window and there were flames each side of the carriage and smoke coming in."
"We couldn't actually get out. We pushed the emergency thing and nothing happened so we were stuck in there and it was pretty scary."
Another told the BBC: "We could hear some alarms going off for about four or five minutes and then one of the other passengers could smell smoke so they alerted the conductor and he said there was nothing the matter.
"The next thing we knew there was smoke and flames ripping down the carriageway.
"There were 23 people on there but had it been the half-past five train where it's completely packed out, there could have been people killed on it."
Some passengers were forced to move to the rear three carriages to stay safe.
"The door wouldn't open at first. We finally opened it and jumped out," another said.
One passenger said there had been a smell of burning from the time the train left Bristol.
Andy Griffiths from Wessex Trains said: "The doors had been opened when the train was brought to a controlled standstill, and the proper evacuation procedure was carried out.
"There is going to be a full investigation and safety is the priority in operating our railways these days.
"We do take these things very seriously and we will learn all the lessons we can from this."
An investigation is under way to determine what caused the fire.
A British Transport Police spokesman said that preliminary investigations suggested a mechanical fault was to blame.
There is currently a speed restriction at the spot between Weston and Bristol where the fire happened.