The Prophet ﷺ said, "A strong demon from the Jinns came to me yesterday suddenly, so as to spoil my prayer, but Allah enabled me to overpower him, and so I caught him and intended to tie him to one of the pillars of the Mosque so that all of you might see him, but I remembered the invocation of my brother Solomon: 'And grant me a kingdom such as shall not belong to any other after me.' (38.35) so I let him go cursed."
عَنِ النَّبِيِّ ﷺ إِنَّ عِفْرِيتًا مِنَ الْجِنِّ تَفَلَّتَ الْبَارِحَةَ لِيَقْطَعَ عَلَىَّ صَلاَتِي فَأَمْكَنَنِي اللَّهُ مِنْهُ فَأَخَذْتُهُ فَأَرَدْتُ أَنْ أَرْبُطَهُ عَلَى سَارِيَةٍ مِنْ سَوَارِي الْمَسْجِدِ حَتَّى تَنْظُرُوا إِلَيْهِ كُلُّكُمْ فَذَكَرْتُ دَعْوَةَ أَخِي سُلَيْمَانَ رَبِّ هَبْ لِي مُلْكًا لاَ يَنْبَغِي لأَحَدٍ مِنْ بَعْدِي فَرَدَدْتُهُ خَاسِئًا عِفْرِيتٌ مُتَمَرِّدٌ مِنْ إِنْسٍ أَوْ جَانٍّ مِثْلُ زِبْنِيَةٍ جَمَاعَتُهَا الزَّبَانِيَةُ