Harlech Castle in Gwynedd is set to get a new visitors' centre, after heritage officials bought a hotel neighbouring the 700-year-old fortress.
The assembly government's heritage arm, Cadw, says the decision to acquire the Castle Hotel will help deliver a better experience for tourists.
Plans will see the ground floor of the hotel turned into a visitors' centre.
Cadw said it was the first phase in a programme to improve facilities for the castle's 90,000 visitors every year.
"The Heritage Tourism Project at Harlech will vastly improve the ways we can introduce visitors to the key stories about the history of Harlech and its environs," said Marilyn Lewis, Director of Cadw.
"It also provides an integrated package on which to develop Harlech as a very special heritage destination.
"This is the first phase of a larger project that will see improvements being made to the facilities within the castle itself."
Complete in 1290, Harlech Castle boasts being Edward I's cheapest castle - but also one of the most enduring and formidable.
The castle was captured by Owain Glyndwr in 1404, and held for four years before being retaken by the monarch.
It also saw action in the War of the Roses and the Civil War, both times being the last fort to fall in those military campaigns.
When it was originally built, the sea swept up to the foot of the castle's cliffs, allowing it to be supplied by boat.
During the War of the Roses, it held out to siege for seven years, often taken as the inspiration for the song, Men of Harlech.
The purchase of the hotel and its car park, which stand next to the castle entrance, was funded from the assembly government's £19m heritage tourism project, which is backed by a further £8.5m in European cash.
The European Regional Development Fund cash will be used specifically to secure the ground floor section of the building as the new visitors' centre.
Heritage Minister, Alun Ffred Jones, added: "I am pleased that Cadw, through the Heritage Tourism Project, has been able to secure a long-term solution for visitor access and interpretation improvements at Harlech Castle and give the town a welcome boost.
"The Heritage Tourism Project is a vitally important tool as a way of generating imaginative and creative solutions to Wales' tourism needs."