More improvements and some repairs were carried out by Henry III, these improvements including a bridge across the River Severn leading to a barbican in the outer wall. Henry III often used it as a residence, and it played an important role in the barons' war when it was besieged twice in 1264–5. Part of the castle had been being used as a gaol by 1185 and it was probably then the official county gaol, as it certainly was by 1228, and Eleanor of Brittany, niece of King John and cousin of Henry III with a better claim to the throne according to primogeniture and thus becoming a state prisoner, had been briefly imprisoned there during the reign of John, from 1222 to 1223, and from 1237 to 1238.