A prisoner has had their freedom taken from them by law.