Just as it pleased the Lord to prosper you and make you increase in number, so it will please him to ruin and destroy you.
Ezekiel 18:23, 32
Do I take any pleasure in the death of the wicked? declares the Sovereign LORD. Rather, am I not pleased when they turn from their ways and live?
For I take no pleasure in the death of anyone, declares the Sovereign LORD. Repent and live!
The above passages discuss God's reaction to two different aspects of punishment for sin. God is just and rejoices when justice is served, which includes punishing those who have done wrong and aren't sorry about it. If God didn't punish evil, he would be unjust, not to mention unconcerned with the victims of the crime, which would be cause for his having sorrow and shame instead. Since God is just, he punishes evil and can be satisfied that he has done the right thing. If the punishment would move the wrongdoer to repentance, he would also be pleased in the punishment's having that effect.
Yet God loves his creation and hates to see people suffer, even when it's the result of just punishment. When people, even
evil people, feel the effects of punishment, God grieves for them. God desires what is best for everyone, and is further
grieved when people don't do what is right and thus prevent him from blessing them and increasing their joy.
Hence God takes pleasure in doing what is right and executing justice, while simultaneously grieving over the evil that was
done and the consequences of it for the evildoer.