 It was used as the county prison until 1900, when the remaining prisoners were transferred to Wakefield Prison, and from then onwards the facility was used as a military prison instead.By the early 19th century, dredging and other improvements to the river Foss had made it possible to import flour into York by river, reducing the economic significance of the castle mills.In 1856, the castle mills were finally demolished as part of a further sequence of improvements to this part of the river.