AOG - as you and I know of old, judges are obliged to stand by the letter of the law, regardless of their human feelings in the matter.
In this case, it would be hard to find anyone who would not argue with this decision, but it is the law, and as such, it must be obeyed.
Laws are designed to protect people - and ufortunately it means that for every innocent individual who remains safe from harm under this legislation, sooner or later, someone like this is also covered, and able to take advantage.
The legal system does not work on the basis of 'we enforce the law, unless we decide that someone is not deserving or its protection - in which case we do not enforce it in that case.
That would render all law utterly unworkable.
So, although in this case, application of the law appears wrong, it is still right in the wider sense, and this must be the way the legal system works until someone finds a better way - and simply arbitrarily deciding who does and who does not get protection based on what they may do, is not a basis for a workable legal system.