A police officer acted as a negotiator in Elgin on Thursday evening when reports were received of a young man in trouble at the Pinefield Bridge.
The area around the bridge was sealed off at around 9pm after police received reports that a young man was in trouble.
Police vehicles rushed to the scene and quickly secured the area around the rail bridge, which is currently closed for engineering works.
Paramedics were also called to the scene with the incident brought to a close after half an hour when a police officer managed to lead the boy to safety.
It is understood that the man had recently suffered a bereavement.
He was taken to a waiting ambulance and checked over by paramedics.