Abu Huraira (May God be pleased with him) narrates:
When the verse “whoever works evil will be requited accordingly. Nor will he find, besides Allah, any protector or helper.” (Surah an-Nisa , 4/123) was revealed, a serious distress overcame the believers.
Following this, the Prophet (Peace and Blessings be Upon Him) recommended:
“Try to find the middle and right way in all your actions. No harm afflicts any Muslim without God wiping out his sins by it.
It doesn’t matter whether that harm is an unexpected event, or a thorn pricking his foot.”