Jarvis, the engineering company at the centre of the Potters Bar rail inquiry, pulled out of the rail maintenance business today.
The decision follows Jarvis's admission that it was at fault for last month's derailment at Kings Cross station in London.
Railtrack's successor company Network Rail will now take three Jarvis maintenance contracts back in–house – Central, East Coast Mainline and the Liverpool, North Wales and Merseyside contract.
Jarvis insisted today that it stood by its maintenance record and that its decision had been taken purely on commercial grounds.
But Jarvis's group finance director Robert Kendall admitted that the decision had been influenced by "reputational issues" which had "overshadowed" the bulk of the group's operations.
Jarvis was responsible for maintaining the section of track south of Potters Bar station, where seven people died in May 2002 when a West Anglia Great Northern train derailed on a set of points.
Shortly after the accident, Jarvis had issued a statement saying that sabotage could not be discounted.
But a Health and Safety Executive (HSE) report in May 2003 said there was no evidence of sabotage or deliberate unauthorised interference with the points.
Jarvis chairman Paris Moayedi said today: "The board of Jarvis has decided to focus on the business of delivering its core services to even higher standards of excellence."
Rail maintenance accounts for less than 15% of Jarvis's turnover and Jarvis now intends to concentrate on its other core activities, including track renewals.
Mr Moayedi added: "Network Rail (NR) has decided to take these contracts back in–house. We will work closely with NR to ensure the handover is as smooth as possible."
Jarvis said earlier this week it expected first half turnover and profits to be substantially ahead of last year.
Strong growth in turnover was principally due to its rail track renewal activities.
Late last month Jarvis was in court to answer a charge of breaching health and safety regulations relating to a coal train derailment near Rotherham in south Yorkshire. The case was adjourned until October 20.
Jarvis is based at Watton–at–Stone, Hertfordshire. Around 3,500 staff working on rail maintenance will now work for NR, but Mr Kendall said today that there could be some redundancies.
NR chief executive John Armitt said: "We are pleased to have reached this agreement with Jarvis. Jarvis has decided to exit rail maintenance and we have concluded that the best way forward is to bring these contracts in–house.
"We will work closely with Jarvis in the coming months to ensure a smooth transition."
The Transport Secretary Alistair Darling said: "I fully support this agreement. It's not just money that is needed to improve the railways but better management too.
"Network Rail has to take the necessary decisions to achieve that and they are entirely right to do so."
A spokesman for the transport union TSSA said: "We feel that following this news Network Rail should now abandon plans to make 700 managers redundant.
"We are keen to see as much of rail maintenance taken in–house as possible."
The Liberal Democrat transport spokesman Don Foster said: "The decision of Network Rail to bring this work in–house is extremely welcome, but it provides a golden opportunity to go a step further.
"Major train operating companies should be offered the chance to take over the maintenance of the track on which their trains run.
"Bringing track and train together again would help reduce the ridiculous fragmentation that has so bedevilled the railway industry since privatisation."