Aberystwyth's now mainly ruined castle was erected in 1277; like many other castles in Wales, it was captured by Owain Glyndŵr at the start of the 15th century and slighted by Oliver Cromwell in the 17th. By the beginning of the 19th century, the town's walls and gates had completely disappeared and much of the stone was repurposed by locals.
The town developed a fishing industry, and silver and lead mining were also important here. With the arrival of the railway in 1864, the town reinvented itself as a fashionable seaside destination. In 1872 Aberystwyth was chosen as the site of the first college of the University of Wales (Aberystwyth University now has over 9000 students), in 1907 it became home to the National Library of Wales, and in 1955 it was in the running for the honour of national capital.