Narrated Abuz Zinad: When the Messenger of Allah ﷺ cut off (the hands and feet of) those who had stolen his camels and he had their eyes put out by fire (heated nails), Allah reprimanded him on that (action), and Allah, the Exalted, revealed: "The punishment of those who wage war against Allah and His Messenger and strive with might and main for mischief through the land is execution or crucifixion. "
Related hadith on this topic
Explanation & Benefits
Hafiz Muhammad Ameen
This narration is weak. This verse was not revealed by Allah Ta'ala to express displeasure towards the Messenger of Allah (sallallahu alayhi wa sallam); rather, what is correct is what has been mentioned in other narrations: that the Messenger of Allah (sallallahu alayhi wa sallam) gouged out their eyes because they had treated the shepherd of the Messenger of Allah (sallallahu alayhi wa sallam) in that manner, so the same treatment was meted out to them in retribution (qisas). And Allah knows best.
Source: Sunan Nasa'i: Translation and Benefits by Shaykh Hafiz Muhammad Amin Hafizullah, Page: 4047