A row between two railway museums over the future home of a famous locomotive has been resolved.
For most of the past 163 years Locomotion No 1, the first engine to pull a passenger train on a public railway, has been in Darlington.
Its owners the National Railway Museum (NRM) wanted to move it nine miles to Shildon, which was opposed by the council-run Head of Steam Museum.
Now a deal has been struck for the two sites "to share" the engine.
Almost 7,000 people petition signed a petition for Locomotion 1 to stay on display in Darlington.
The Head of Steam had the engine under a loan agreement from the NRM which was due to end this month.
The NRM, part of the Science Museum Group, intended to move the engine to the Locomotion museum in Shildon to form the centrepiece of a multimillion-pound redevelopment to mark 200 years since the first trip on the Stockton and Darlington Railway on 27 September 1825.
The new agreement means the engine will move to Shildon in the coming weeks, but return to Darlington in 2025 for six months.
It will go back to the town again for a year sometime between 2026 and 2030.
Heather Scott, leader of Darlington Borough Council, said: "I know that there are many people who, like myself, are incredibly disappointed to see Locomotion No 1 leave Darlington where it has been on display for more than 160 years.
"Although it is leaving our town, it remains part of our history, and we will rightly remain proud of the part Darlington has played and continues to play in the story of the railways."
The engine was saved from being scrapped in 1857 by the Pease family of Darlington and - aside from a handful of celebratory events and exhibitions- has been in the town ever since.