A good deal of things are illegal that aren't wrong.
For example, it's illegal to kill a snake with a walking stick on the sidewalk in my cousin's college town. Here, in my state, it's illegal to have sex in any position other than missionary. In most places, it's illegal for a woman to walk outside without a shirt on (though perfectly legal for a man to do so).
On the flip side, I think in one of the more Northern states (forgot which), it's legal to kill any group of Native Americans that's composed of 3+ people because it's officially declared a "war party" (I don't know if that one has been stricken from the books yet or not though).
Illegal and wrong are not synonymous.