The monastery served as a prison for disgraced clergy and state figures, as well as Old Believers and heretics.