Harlech Castle, located in Harlech, Gwynedd, Wales, is a medieval fortification, constructed atop a spur of rock close to the Irish Sea. It was built by Edward I during his invasion of Wales between 1282 and 1289 at the substantial cost of £8,190. Over the next few centuries, the castle played an important part in several wars, withstanding the siege of Madog ap Llywelyn between 1294–95, but falling to Owain Glyndwr in 1404. It then became Glyndwr's residence and military headquarters for the remainder of the uprising until being recaptured by English forces in 1409. During the 15th century Wars of the Roses, Harlech was held by the Lancastrians for seven years, before Yorkist troops forced its surrender in 1468, a siege memorialised in the song Men of Harlech. Following the outbreak of the English Civil War in 1642, the castle was held by forces loyal to Charles I, holding out until 1647 when it became the last fortification to surrender to the Parliamentary armies. In the 21st century the ruined castle is managed by Cadw, the Welsh Government's historic environment service, as a tourist attraction.
UNESCO considers Harlech to be one of "the finest examples of late 13th century and early 14th century military architecture in Europe", and it is classed as a World Heritage site. The fortification is built of local stone and concentric in design, featuring a massive gatehouse that probably once provided high-status accommodation for the castle constable and visiting dignitaries. The sea originally came much closer to Harlech than in modern times, and a water-gate and a long flight of steps leads down from the castle to the former shore, which allowed the castle to be resupplied by sea during sieges. In keeping with Edward's other castles in North Wales, the architecture of Harlech has close to links to that found in the kingdom of Savoy during the same period, an influence probably derived from the Savoy origins of the main architect, James of Saint George.