As Jonathan Edwards says:
“It implies no contradiction to suppose that an act may be an evil act, and yet that it is a good thing that such an act should come to pass. . . . As for instance, it might be an evil thing to crucify Christ, but yet it was a good thing that the crucifying of Christ came to pass.”
In other words, the Scriptures lead us to the insight that
God can will that a sinful act come to pass without willing it as an act of sin in himself.
John Piper
From the book “Does God Desire All to Be Saved?”