A man used a fire extinguisher to attack ScotRail staff and police at Perth railway station.

Neal Mackay, 25, of Alloa, Clackmannanshire, was so out of control that CS spray failed to stop him and he had to be locked inside a train.

He has been ordered to pay £2400 compensation after wrecking several carriages during his late-night drunken rampage after initially being spotted walking on the tracks.

Mackay, who later claimed to have no recollection of the events, admitted four charges of assault with fire extinguishers and causing damage to trains on July 31 last year.

Fiscal depute Rebecca Kynaston told Perth Sheriff Court: "Witness Stuart Duncan was moving a train at 11pm when they observed the accused walking on the track near platform three.

"He sounded the horn and notified the signal box to warn of the danger. When he stopped and went to look for the accused he heard a horn sounding on platform four.

"There were two unoccupied trains. He observed the front cabin door of the rear train lying open and he could hear banging from within.

"He saw the accused standing in the carriage, removing the pin from a fire extinguisher. The accused approached in an aggressive manner and discharged the fire extinguisher directly in the face of Mr Duncan. He was 2ft away."

Mackay then moved to the other train and was seen tooting the horn and pressing buttons on the driver's console before letting off an extinguisher across the control panel.

Ms Kynaston said: "Mr Duncan was concerned by the conduct and disabled the doors to contain the accused within."

Numerous station staff and several police officers arrived at the scene but attempts to reason with Mackay failed and he continued to smash up the train carriages.

He used the fire extinguishers to smash two windows and fired them at close range at the faces of Neil Thomson and constables Matthew Henry and Gavin Burns.

Officers used CS spray but Mackay continued to "shout and swear incoherently while brandishing the fire extinguishers".

Mackay taunted officers by saying: "Do you get paid enough for this?"

Eventually one of the officers took Mackay down with a baton and disarmed him.

Solicitor Nicky Brown, defending, said: "He has no memory at all of events. At the outset his behaviour is bizarre and then becomes something else when the authorities get involved.

"It appears to be an alcohol fuelled incident that got out of control."

Sheriff Fiona Tait said: "Station staff and police should not have to deal with that. He has caused a lot of damage. His cannabis habit won't have helped. It's extremely fortunate no one was injured."

The sheriff ordered Mackay to complete 300 hours' unpaid work and pay £2400 compensation.

Mackay was also placed under supervision for 14 months and put on a curfew for four months.