392.Section 217 provides that a hospital direction or a transfer for treatment direction ceases to have effect when the underlying sentence of imprisonment to which the patient is subject comes to an end under the terms of Part 1 of the Prisoners and Criminal Proceedings (Scotland) Act 1993. This applies also where the prisoner is released on licence by the Parole Board under that Act.