Smoking on the train ended up costing a Bonnyrigg man £400.
After being caught having a sly cigarette on the First ScotRail Inverness to Edinburgh service on March 28, Thomas Gaynor received a warning from the conductor.
Gaynor then started verbally abusing her, swearing and calling her names.
The terrified woman contacted the police and arranged for officers to meet the train at Perth railway station, where the 58-year-old, of Auld Coal Grove in Bonnyrigg, was arrested.
Solicitor Paul Ralph told Perth Sheriff Court on Tuesday that his client had been in Aviemore earlier that day visiting a family member and had consumed alcohol before getting on the train.
He said: “He did indeed have a cigarette in the toilet, which he admitted. When he went back to the toilet, he felt he had been wrongfully accused of having another one.”
Mr Ralph said Gaynor had been struggling with personal issues at the time of the offence, which subsequently forced him to give up his two jobs to care for his family.
Gaynor admitted behaving in a threatening or abusive manner by shouting and swearing at the woman.