Suhayb reported,

The Messenger of Allah ﷺ said:"Among the people who lived before you, there was a king who had a sorcerer. When the sorcerer grew old, he said to the king, 'I have grown old, so send me a boy whom I can teach sorcery.'So the king sent him a boy to teach. On his way, the boy would pass by a monk, so he sat with him and listened to his words and was impressed by them. Whenever the boy went to the sorcerer, he would pass by the monk and sit with him. When he reached the sorcerer, the sorcerer would beat him. He complained about this to the monk, who said, 'When you fear the sorcerer, say, My family kept me. And when you fear your family, say, The sorcerer kept me.'While matters continued like this, he came upon a huge beast that was blocking the people's path. He said, 'Today I shall find out whether the sorcerer is better or the monk is better.' He picked up a stone and said, 'O Allah, if the matter of the monk is more beloved to You than the matter of the sorcerer, then kill this beast so the people may pass.' He threw the stone and killed it, and the people went on their way.He came to the monk and told him what had happened. The monk said to him, 'My son, today you are better than I am. Your affair has reached what I now see, and you will surely be tested. If you are tested, do not point me out.'The boy used to heal those born blind and the lepers, and he treated people of all kinds of diseases. A companion of the king who had gone blind heard about him and came to him with many gifts. He said, 'All of these are yours if you cure me.' The boy replied, 'I do not cure anyone. Only Allah cures. If you believe in Allah, I will pray to Allah and He will cure you.' So he believed in Allah, and Allah cured him.He then came to the king and sat with him as he used to sit. The king said to him, 'Who restored your sight?'He said, 'My Lord.'The king said, 'Do you have a lord other than me?'He said, 'My Lord and your Lord is Allah.'So the king seized him and tortured him relentlessly until he pointed out the boy. The boy was brought, and the king said to him, 'My son, your sorcery has reached the point that you cure those born blind and the lepers, and you do this and that.'He said, 'I do not cure anyone. Only Allah cures.'So the king seized him and tortured him relentlessly until he pointed out the monk. The monk was brought, and was told, 'Renounce your religion.' He refused. So the king called for a saw, placed it on the middle of his head, and split it until the two halves fell apart.Then the king's companion was brought and told, 'Renounce your religion.' He refused. So the saw was placed on the middle of his head and split it until the two halves fell apart.Then the boy was brought and told, 'Renounce your religion.' He refused. So the king handed him over to a group of his men and said, 'Take him to such and such a mountain. Climb the mountain with him, and when you reach its summit, if he renounces his religion, well and good. Otherwise, throw him off.'They took him and climbed the mountain. The boy said, 'O Allah, suffice me against them however You will.' So the mountain shook beneath them, and they fell. The boy walked back to the king. The king said to him, 'What happened to your companions?'He said, 'Allah sufficed me against them.'So the king handed him over to another group of his men and said, 'Take him out, carry him in a small boat, and when you reach the middle of the sea, if he renounces his religion, well and good. Otherwise, cast him into the sea.'They took him, and he said, 'O Allah, suffice me against them however You will.' So the boat capsized with them and they drowned. The boy walked back to the king. The king said to him, 'What happened to your companions?'He said, 'Allah sufficed me against them.'Then he said to the king, 'You will not be able to kill me until you do what I command you.'The king said, 'And what is that?'He said, 'Gather the people on a single plain and crucify me on a tree trunk. Then take an arrow from my quiver, place the arrow in the middle of the bow, and say, In the name of Allah, the Lord of the boy. Then shoot me. If you do that, you will kill me.'So the king gathered the people on a single plain and crucified him on a tree trunk. Then he took an arrow from his quiver, placed it in the middle of the bow, and said, 'In the name of Allah, the Lord of the boy.' Then he shot him. The arrow struck his temple, and the boy placed his hand on his temple where the arrow had struck and died.The people said, 'We believe in the Lord of the boy. We believe in the Lord of the boy. We believe in the Lord of the boy.'The king was approached and told, 'Do you see what you used to fear? By Allah, what you feared has come upon you. The people have believed.' So he ordered trenches to be dug at the entrances of the streets, and they were dug. He had fires kindled in them and said, 'Whoever does not renounce his religion, throw him into it,' or, it was said, 'Tell him to plunge in.' They did so until a woman came carrying her infant child, and she hesitated to fall into the fire. The boy said to her, 'Mother, be patient, for you are upon the truth.'"

Muslim 7511

Sahih

حدثنا هداب بن خالد حدثنا حماد بن سلمة حدثنا ثابت عن عبد الرحمن بن أبي ليلى

عن صهيب

أن رسول الله ﷺ قال كان ملك فيمن كان قبلكم وكان له ساحر فلما كبر قال للملك إني قد كبرت فابعث إلي غلاما أعلمه السحر فبعث إليه غلاما يعلمه فكان في طريقه إذا سلك راهب فقعد إليه وسمع كلامه فأعجبه فكان إذا أتى الساحر مر بالراهب وقعد إليه فإذا أتى الساحر ضربه فشكا ذلك إلى الراهب فقال إذا خشيت الساحر فقل حبسني أهلي وإذا خشيت أهلك فقل حبسني الساحر فبينما هو كذلك إذ أتى على دابة عظيمة قد حبست الناس فقال اليوم أعلم آلساحر أفضل أم الراهب أفضل فأخذ حجرا فقال اللهم إن كان أمر الراهب أحب إليك من أمر الساحر فاقتل هذه الدابة حتى يمضي الناس فرماها فقتلها ومضى الناس فأتى الراهب فأخبره فقال له الراهب أي بني أنت اليوم أفضل مني قد بلغ من أمرك ما أرى وإنك ستبتلى فإن ابتليت فلا تدل علي وكان الغلام يبرئ الأكمه والأبرص ويداوي الناس من سائر الأدواء فسمع جليس للملك كان قد عمي فأتاه بهدايا كثيرة فقال ما هاهنا لك أجمع إن أنت شفيتني فقال إني لا أشفي أحدا إنما يشفي الله فإن أنت آمنت بالله دعوت الله فشفاك فآمن بالله فشفاه الله فأتى الملك فجلس إليه كما كان يجلس فقال له الملك من رد عليك بصرك قال ربي قال ولك رب غيري قال ربي وربك الله فأخذه فلم يزل يعذبه حتى دل على الغلام فجيء بالغلام فقال له الملك أي بني قد بلغ من سحرك ما تبرئ الأكمه والأبرص وتفعل وتفعل فقال إني لا أشفي أحدا إنما يشفي الله فأخذه فلم يزل يعذبه حتى دل على الراهب فجيء بالراهب فقيل له ارجع عن دينك فأبى فدعا بالمئشار فوضع المئشار في مفرق رأسه فشقه حتى وقع شقاه ثم جيء بجليس الملك فقيل له ارجع عن دينك فأبى فوضع المئشار في مفرق رأسه فشقه به حتى وقع شقاه ثم جيء بالغلام فقيل له ارجع عن دينك فأبى فدفعه إلى نفر من أصحابه فقال اذهبوا به إلى جبل كذا وكذا فاصعدوا به الجبل فإذا بلغتم ذروته فإن رجع عن دينه وإلا فاطرحوه فذهبوا به فصعدوا به الجبل فقال اللهم اكفنيهم بما شئت فرجف بهم الجبل فسقطوا وجاء يمشي إلى الملك فقال له الملك ما فعل أصحابك قال كفانيهم الله فدفعه إلى نفر من أصحابه فقال اذهبوا به فاحملوه في قرقور فتوسطوا به البحر فإن رجع عن دينه وإلا فاقذفوه فذهبوا به فقال اللهم اكفنيهم بما شئت فانكفأت بهم السفينة فغرقوا وجاء يمشي إلى الملك فقال له الملك ما فعل أصحابك قال كفانيهم الله فقال للملك إنك لست بقاتلي حتى تفعل ما آمرك به قال وما هو قال تجمع الناس في صعيد واحد وتصلبني على جذع ثم خذ سهما من كنانتي ثم ضع السهم في كبد القوس ثم قل باسم الله رب الغلام ثم ارمني فإنك إذا فعلت ذلك قتلتني فجمع الناس في صعيد واحد وصلبه على جذع ثم أخذ سهما من كنانته ثم وضع السهم في كبد القوس ثم قال باسم الله رب الغلام ثم رماه فوقع السهم في صدغه فوضع يده في صدغه في موضع السهم فمات فقال الناس آمنا برب الغلام آمنا برب الغلام آمنا برب الغلام فأتي الملك فقيل له أرأيت ما كنت تحذر قد والله نزل بك حذرك قد آمن الناس فأمر بالأخدود في أفواه السكك فخدت وأضرم النيران وقال من لم يرجع عن دينه فأحموه فيها أو قيل له اقتحم ففعلوا حتى جاءت امرأة ومعها صبي لها فتقاعست أن تقع فيها فقال لها الغلام يا أمه اصبري فإنك على الحق

مسلم 7511صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Asceticism and heart-softening matters
Chapter
Story of the people of the ditch, the sorcerer, the monk, and the boy
Numbering
Darussalam 7511
Muslim 7511