Rail travel between Glasgow and Dumfries could be disrupted for two weeks after a crash between two trains during engineering work at the weekend.
The track was damaged at Logan, just east of Cumnock in Ayrshire, when the trains carrying ballast collided and wagons were derailed on Saturday.
Scotrail said a replacement bus service would be running between Dumfries and Kilmarnock.
Network Rail said it could take 10 days to move the derailed wagons.
It will also take about three days to repair the damaged track after the wagons are removed.
Network Rail said a crane was being brought in to remove the wagons.
Speaking on BBC Radio Scotland's Good Morning Scotland programme, Network Rail's infrastructure director David Dickson said there had been "extensive damage".
"We think it will take around ten days to get all the wagons off as it's quite a complicated operation," he added.
"We need to build an access road for a crane, which will then be built on site, to remove the carriages before we rebuild the track."
A ScotRail Alliance spokesman said: "We apologise to customers affected by the disruption. Replacement buses have been arranged to minimise the impact and specialist engineers are working to reopen the line as quickly as possible."
ScotRail tickets will be accepted between Carlisle and Glasgow Central by Virgin Trains West Coast and TransPennine Express.