A judge has told a farmer who parked a trailer on a rail line which was hit by a train he was "incredibly stupid."
John Watkyn-James, 51, from Kidwelly, Carmarthenshire had admitted endangering safety on a railway at an earlier hearing at Swansea Crown Court.
Sentencing him to a 36-week suspended jail sentence, the judge said he had put the train, staff and passengers at risk when he parked to feed horses.
The Manchester to Milford Haven train was damaged but no-one was injured.
The farmer from Kidwelly must also carry out 200 hours community work.
Watkyn-James, of Limestone Hill Farm, parked his tractor next to the track at Kidwelly on 31 January with the trailer he was towing on the line.
The 08:30 service from Manchester crashed into it at about 13:30 GMT.
The court heard the farmer had parked the vehicle while he went to feed his horses.
A CCTV image of the trailer over the railway line A CCTV image of the trailer left over the railway line, while John Watkyn-James fed horses in a field
Judge Paul Thomas QC said: "You put the train, staff and passengers at risk. You took a risk to save a few minutes."
As the train driver rounded a bend just before the crossing, he saw the trailer and applied the emergency brakes.
The driver then dived to the floor to protect himself, as he knew a collision was imminent, the court was told.
CCTV shows the driver desperately trying to stop.
The train struck the trailer at 75mph and came to a stop about 100 yards further down the track.
None of the 20 passengers were injured, but the train was extensively damaged.
After the case, Sgt Steve Dawkins, of British Transport Police, said despite the trailer being made of plate steel, the speed of the train and the force of impact meant debris was spread over a large area.
The front of the damaged train Repairs costing nearly £82,000 were needed to the train
"It is astounding that no one was seriously injured or killed in this incident," said Sgt Dawkins.
He said the incident could easily have resulted in derailment.
"Crossings are designed to keep people safe - and, when used correctly, that is exactly what they do."
After the sentence, Watkyn-James told BBC Wales he was sorry about what happened and "luckily no-one was hurt".
The train cost nearly £82,000 to repair, with further costs of £84,862 from the train being out of service.
Mark Langman, route managing director for Network Rail, said: "Thankfully no one was injured as a result of this incident. What happened was extremely dangerous and a stark reminder of the potential consequences of crossing misuse."
Arriva Trains Wales operations and safety director Peter Leppard said it had been a "reckless act".
"I am proud of the actions of the train crew, who dealt well with the aftermath, but they should not have found themselves in that situation," he added.
http://www.bbc.co.uk/news/uk-wales-south-west-wales-15493970
Shame he was given a prison sentance!