Against the backdrop of the Great Northern War, the monastery strengthened its defences and continued to serve as a prison for political and religious prisoners.