Rail services were temporarily suspended after a vehicle hit a bridge in Burntisland.
The incident happened in Harbour Place, near Burntisland Railway Station, on Tuesday afternoon.
ScotRail engineers were sent to examine the bridge and declared the structure safe.
Train services were back up and running by about 2.30pm.
ScotRail staff have now examined the bridge near #Burntisland and declared it safe for use after a road vehicle had collided with it earlier today; therefore all lines have now reopened between Aberdour and Burntisland… 1/2
— National Rail (@nationalrailenq) February 6, 2018
Travellers were warned that services between Edinburgh and Glenrothes, via Kirkcaldy would be affected by the incident. Services between Edinburgh and Inverness were also subject to disruption.
NEW: Due to a road vehicle colliding with a bridge between #Burntisland & Aberdour, services between Edinburgh – Glenrothes via Kirkcaldy & Inverness – Edinburgh will be delayed or revised. pic.twitter.com/6aHjFpNwnn
— ScotRail (@ScotRail) February 6, 2018