Haverfordwest prison was originally built in the inner ward of a ruined castle in 1778. It was considered unfit for prisoners in 1819, while Cardiff Gaol was deemed insufficient in 1814. Some prisons were built for purpose, including Beaumaris Gaol (1829) in Anglesey. In 1878 the prison system in Wales was nationalised and came under centralised government control. This led to better conditions and fewer, larger prisons. The smaller prisons and gaols across the country were closed and the location of the prisons centralised. Until 2017 there was no provision for prisoners in northern Wales, with prisoners sent to prisons in Liverpool and further afield. In 2009 a site was discussed for a new prison in Caernarfon to address the issue of Welsh prisoners who are housed in England, but this fell through. In 2013 the government announced the construction of a new £250 million 'super prison' in Wrexham. Work on the new prison, named HMP Berwyn, commenced in 2014 and it became partially operational in February 2017. There are five prisons in Wales,   Wales has no prison for either women or Category A offenders, who must be housed in gaols in England.