A 14-year-old girl with a knife threatened to kill herself while standing on the train tracks at a Hampshire railway station.
Train services were stopped outside Farnborough station while police officers tried to talk the teenager off the tracks.
The immediate area was cleared and the live rail's power was turned off during the incident on Thursday afternoon.
After an hour, the girl came off the tracks and was detained by police.
She has since been released into the care of relatives.
Inspector Jim Little said: "Necessary precautions were taken.
"It did cause some disruption to services because the line had to be closed for some time."