Engineers are to remove 18 derailed freight wagons and a locomotive from a site near Cumnock in Ayrshire following a collision on Saturday 1 August.
The rail line between Kilmarnock and Dumfries is expected to remain closed until 17 August while contractors build a road to access the derailment site and then build a pad for the 1,000t crane that will be required to lift the wagons back on the line.
The derailment happened around 11:20am on Saturday when two ballast trains bringing materials into a track renewals worksite collided.
“Every effort is being made to recover the line and restore a full service for passengers as quickly as possible,” said ScotRail Alliance infrastructure director David Dickson.
“Our engineers will be working around the clock to remove the derailed wagons and repair the damaged track beneath.
“This is a very complex operation and we will need to build an access road for a 1,000t crane, which will then have to be built on site, before we can remove the wagons and repair the track.
“We understand the inconvenience this incident has caused passengers and replacement buses are in operation to serve the stations affected by the recovery works.”
Works are complicated by the need to ensure there are no mine-workings in the area beneath the derailment.
No-one was injured in the accident, which is being investigated by the Rail Accident Investigation Branch.