The Fry Model Railway is to return to Malahide as the centrepiece of a new €2m tourism development.
The model railway, which was put in storage last year when it was evicted from Malahide Castle, contains a model of every type of train that ran on the railways of Ireland.
It will now be at the heart of a new tourism development at the site of the old Casino House in the seaside town.
The development will also involve the restoration, preservation and conservation of the thatched 17th-century Casino House.
The move has been welcomed by Transport Minister Leo Varadkar who said: "I'm delighted that this matter has been finally resolved."
Failte Ireland and Fingal County Council are in the final stages of negotiations over the return of the model railway to Malahide, where it will be open to the public in a purpose-built building next to the old Casino House.
The minister also acknowledged the late Michael Gaffney, a 93-year-old retired farmer, who came to the rescue of Casino House and the railway with a donation of €1.5m to buy and upgrade the old building.
The Fry Collection and Model Railway was created by Cyril Fry and his family over almost 40 years.
It contains a model of every train that ran on the railways of Ireland, including experimental turf-burning trains. The Dart and Luas are both represented.
It was acquired by Dublin Tourism from the Fry family in the 1970s and housed in a purpose-built unit in the courtyard of Malahide Castle until 2010.
Its closure in 2010 prompted an outcry from appalled train and toy enthusiasts.
The Casino House dates back to at least the 18th century was probably a romantic summer house.