Laws are only ever a backstop for conscience anyway. Of course he has to be locked away, if only so that others with similarly deficient wiring see him as an example, and possibly choose not to follow whatever sick predilection they're feeling as a result. If it stops one such incident it's worth it to try, convict and imprison him.
Deterrence doesn't always work so well when it comes to preventing impulsive acts, but building a prison in your basement doesn't qualify there.