During the Civil War Chester was held by the Royalists. The castle was assaulted by Parliamentary forces in July 1643, and in January and April 1645. Together with the rest of the city, it was besieged between September 1645 and February 1646. Following the civil war the castle was used as a prison, a court and a tax office. In 1687 James II attended Mass in the chapel of St Mary de Castro. In 1696 Chester mint was established and was managed by Edmund Halley in a building adjacent to the Half Moon tower. During the 1745 Jacobite rising a gun emplacement was built on the wall overlooking the river.