An enraged rail passenger put fellow travellers on a Bradford-bound service at risk by confronting the driver, a court heard.

John Thompson became annoyed when the train's doors did not open after it stopped at the station where he planned to get off, Bradford magistrates were told.

When it set off again, he opened the door to the driver's cabin, slightly injuring him.

He was arrested by British Transport Police when the train arrived at Bradford Interchange.

Thompson, 52, pleaded guilty to charges of threatening behaviour and endangering railway passengers.

The case was adjourned for a pre-sentence report to be prepared and Thompson was bailed to return to court next month.

Thompson's solicitor Nicholas Leadbeater said his client - who had had some alcohol but was still coherent - had boarded the train at Todmorden, intending to visit his son and his grandson who was ill at the time.

When it reached Halifax station the train came to a halt, but for some reason the doors did not open.

"When the train set off again, the next stop was to be Bradford Interchange," said Mr Leadbeater.

"Mr Thompson cannot explain why a switch seemed to be turned on in his head and he was enraged. He opened the driver's door and it somehow caught the driver. That was never his intention and he was not reckless in the way he opened the door.

"He accepts he used an awful lot of industrial language to the driver - there were a lot of swear words."

Thompson, of Moorend Road, Mount Tabor, Halifax, accepted the driver would have been distracted and therefore some danger was caused to the public.

Mr Leadbeater said: "Fortunately, thankfully, there were no problems. The train speed did not alter and there were no problems.

"He can only apologise and place himself at the mercy of the court."