The Judge is Allowed to Speak of Something That He Will Not Actually Do in Order to Establish the Truth
باب السَّعَةِ لِلْحَاكِمِ فِي أَنْ يَقُولَ لِلشَّىْءِ الَّذِي لاَ يَفْعَلُهُ افْعَلْ لِيَسْتَبِينَ الْحَقَّ .
Sunan an-Nasa'i, Book of The Etiquette of Judges(view book)
Sunan an-Nasa'i 5403
It was narrated from Abu Hurairah that:
The Messenger of Allah ﷺ said: "Two women went out with two children of theirs, and the wolf attacked one of them and took her child. The next day they referred their dispute over the remaining child to Dawud, peace be upon him, and he ruled that (the child) belonged to the older woman. Then they passed by Sulaiman and he said: 'What is your story?' So they told him. He said: 'Bring me a knife and I will cut him in half (to be shared) between you.' The younger one said: 'Will you cut him in half?' He said: 'Yes.' She said: 'Do not do that; I will give my share of him to her.' He said: 'He is your child' and he ruled that he belonged to her."
أَخْبَرَنَا الرَّبِيعُ بْنُ سُلَيْمَانَ، قَالَ حَدَّثَنَا شُعَيْبُ بْنُ اللَّيْثِ، قَالَ حَدَّثَنَا اللَّيْثُ، عَنِ ابْنِ عَجْلاَنَ، عَنْ أَبِي الزِّنَادِ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ، عَنْ رَسُولِ اللَّهِ ﷺ أَنَّهُ قَالَ " خَرَجَتِ امْرَأَتَانِ مَعَهُمَا صَبِيَّانِ لَهُمَا فَعَدَا الذِّئْبُ عَلَى إِحْدَاهُمَا فَأَخَذَ وَلَدَهَا فَأَصْبَحَتَا تَخْتَصِمَانِ فِي الصَّبِيِّ الْبَاقِي إِلَى دَاوُدَ عَلَيْهِ السَّلاَمُ فَقَضَى بِهِ لِلْكُبْرَى مِنْهُمَا فَمَرَّتَا عَلَى سُلَيْمَانَ فَقَالَ كَيْفَ أَمْرُكُمَا فَقَصَّتَا عَلَيْهِ فَقَالَ ائْتُونِي بِالسِّكِّينِ أَشُقُّ الْغُلاَمَ بَيْنَهُمَا . فَقَالَتِ الصُّغْرَى أَتَشُقُّهُ قَالَ نَعَمْ . فَقَالَتْ لاَ تَفْعَلْ حَظِّي مِنْهُ لَهَا . قَالَ . هُوَ ابْنُكِ . فَقَضَى بِهِ لَهَا " .