It is understood that the driver started to go over the crossing before launching a desperate attempt to reverse back off it again when he saw the York-bound train bearing down on him. But he was unable to complete the manoeuvre before the locomotive slammed into his tractor and ripped off the front section. A crushed front tyre could later be seen under the wheels of the train.

Two air ambulances and three road ambulances were among emergency services despatched to the scene near Knaresborough just before 6.20pm on Thursday. But the farmer enjoyed a miraculous escape as he was taken to hospital with only minor injuries along with two of the train passengers.

The train involved in the accident was the 5.29pm from Leeds to York, via Harrogate. Inspector Matt Hagen, of North Yorkshire Police, told ITV Calendar News: “This was a very, very, very lucky escape.”

The incident once more focuses attention on the safe use of agricultural vehicles. Drivers on the M74 motorway in Scotland were last month fortunate to escape injury when a sheepdog called Don took control of his 77-year-old owner’s mini-tractor and drove it across the northbound carriageway and into the central reservation.