I heard the Messenger of Allah ﷺ say, "Whoever's intercession prevents the carrying out of one of Allah's prescribed punishments has opposed Allah in His command."
سمعت رسول الله ﷺ يقول: من حالت شفاعته دون حد من حدود الله عز وجل فقد ضاد الله أمره.
Abu Dawud (3597), Ahmad (5385), and Hakim (2/27) graded it sahih, as did Bayhaqi (6/82). All of them narrated it from the hadith of Zuhayr bin Muawiya, who said, Umara bin Ghaziya narrated to us, from Yahya bin Rashid, who said, "We set out as ten pilgrims from the people of Syria, until we reached Makkah," then he mentioned the hadith. He said, "So we came to him, and he came out to us" meaning Ibn Umar, and he mentioned the hadith in a longer version than this. Its chain of transmission is sahih.This ruling applies after the matter has reached the ruler. But before it reaches the ruler, interceding in it is recommended, in order to preserve the concealment of the offender's wrongdoing. Ahmad said, "One may intercede regarding the prescribed punishment as long as it has not reached the authority."