By the end of Batman: Gotham By Gaslight it is revealed that:
Commissioner Gordon is Jack the Ripper.
Then why did he have a dream earlier about his wife dying at the hands of Jack the Ripper?
It is because of the fact that, Gordon believes that women bring filth and are sins to life. So he feels, as a retired Civil War soldier, it is his duty to clean Gotham of this filth. When Batman finds the secret door where Gordon conducted his experiments in his house, Barbara Gordon tells him that he (commissioner Gordon) freed her of her sins by punishing her.
But still Gordon was afraid of himself that he might even go further and eliminate her to maybe free her of her sins completely, finish it for better.