Abu Saeed Khudri reported,

The people of Qurayzah submitted to the judgment of Saad bin Muaz, so the Messenger of Allah ﷺ sent for Saad, and he came riding a donkey. When he drew near the masjid, the Messenger of Allah ﷺ said to the Ansar, "Stand up for your chief," or "for the best among you."Then he said, "These people have submitted to your judgment."Saad said, "You shall kill their fighting men and take their offspring captive."At this the Prophet ﷺ said, "You have judged according to the judgment of Allah." And sometimes he said, "You have judged according to the judgment of the Sovereign."Ibn Muthanna did not mention, "And sometimes he said, 'You have judged according to the judgment of the Sovereign.'" In his version he said that the Messenger of Allah ﷺ said, "You have judged concerning them according to the judgment of Allah," and on another occasion he said, "You have judged according to the judgment of the Sovereign."

Muslim 4597

Sahih

و حدثنا زهير بن حرب حدثنا عبد الرحمن بن مهدي عن شعبة بهذا الإسناد وقال في حديثه فقال رسول الله ﷺ لقد حكمت فيهم بحكم الله وقال مرة لقد حكمت بحكم الملك

مسلم 4597صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Jihad and expeditions
Chapter
Permissibility of fighting those who broke the covenant and permissibility of allowing the people of a fortress to surrender to the judgment of a just ruler qualified to judge
Numbering
Darussalam 4597
Muslim 4597