A man was seen on a railway line appearing to pray – and when then bowed when a passenger train headed towards him.
Shaun Costigan, 54, refused to react when witnesses shouted at him to move.
The driver of the oncoming train was warned by her headquarters that a man was on the line at Ansdell Station.
The driver then started to brake over a 300m length of track and stopped just 20 metres short of Costigan.
Costigan of Lytham Road,Blackpool, admitted trespassing on the railway when he appeared before District Judge Jeff Brailsford at Blackpool Magistrates Court.
The judge told Costigan: “What you did was extremely dangerous and stupid.
“ You are a very lucky man that you are here today.”
Pam Smith, prosecuting, said: “The defendant was seen by members of the public on the track.
“They told him to move because a train was coming and one of the witnesses rang the police who managed to get an alert through to the train’s female driver.
“At one time the witnesses said Costigan appeared to be praying and as the train came towards him appeared to bow before it.
“The train company estimated a cumulative delay caused by Costigan to its services of 44 minutes.”
Steven Townley, defending, said his client had been homeless at the time and had been sleeping in the area.
He said: “He says he was not praying but had in fact fallen.”
Costigan was ordered to pay £175 in fines and costs.