The Forth Rail Bridge is to be closed during the summer for "essential" maintenance work.
The bridge is one of Scotland's architectural wonders
The iconic structure will be shut for four weekends so that sections can be replaced and areas close to the tracks can be painted.
However, plans to close the bridge the previous month were abandoned because of a clash with pop star Robbie Williams' concerts in Edinburgh.
Alternative arrangements during the closure will include diverting long distance trains via Stirling and Perth and providing extra buses over the neighbouring road bridge.
The 1.5 mile long cantilever rail bridge, which opened in 1890, crosses the River Forth between South Queensferry and North Queensferry.
A spokeswoman for Network Rail said: "As part of the ongoing contract on the Forth Bridge, it is necessary to carry out refurbishment works on areas of the bridge which are adjacent to the track.
"For safety reasons and to maximise the amount of work that can be undertaken, this access will require a full possession of the line.
"We apologise to passengers for any inconvenience these works will cause, but
hope they understand the need for this essential engineering programme to be
carried out on this historic structure."
This is a short, sharp hit to get all the pain out of the way as soon as possible
Rail Passengers Committee
The bridge will be closed on all four weekends in July.
The spokeswoman added that plans to carry out the work in June had been scrapped because of the Robbie Williams concerts at Murrayfield Stadium on 28 and 29 June.
Bill Ure, director of the Rail Passengers Committee Scotland, said delays would be inevitable.
He said: "This is a short, sharp hit to get all the pain out of the way as soon as possible and we can see that this will deliver improved services."
ScotRail said timetables were still being finalised for the period affected.
"Long-distance services from Edinburgh to Inverness and Aberdeen will be diverted via Stirling and Perth," explained a spokeswoman.
"For the Fife services, we will operate a revised timetable of services within Fife with a replacement bus service over the road bridge."