The first act is an act of injustice, while the second act is an act of justice. So both actions carry the same name, while being different in reality. This is how the scholars explain deceit, cunning and mocking when attributed to Allah in the Qur'an. Surely, Allah exacts revenge for certain evil acts with a punishment that is similar in nature to the act itself. We should affirm here that Allah does not do these things out of joyful play, according to the consensus of the scholars, but as a just form of punishment for certain evil acts.