Sure Al-Hajj

22:10

ذَٰلِكَ بِمَا قَدَّمَتْ يَدَاكَ وَأَنَّ ٱللَّهَ لَيْسَ بِظَلَّٰمٍۢ لِّلْعَبِيدِ

"Dies (geschieht) wegen dessen, was deine Hände vorausgeschickt haben, und deshalb, weil Allah keiner ist, der den Menschen Unrecht zufügt."

Tafsir 22:10

It will be said to him: “That punishment which you tasted is due to the disbelief and sins you committed. Allah does not punish any of His creation except due to a sin”.