Capturing Mandalf may make him permanently occupy space in the Prison
I managed to capture Mandalf and imprison him, only for him to appear later outside of the Prison as if nothing happened. As far as I can see it is the intended course of actions, but it left the Prison thinking it still holds him.
Did you use my savegame though? If you do, you'll only need to do last few steps.