Sahih Bukhari
Prophets
Volume: 004 / Book Number: 055 / Hadith Number: 634
Narrated Abu Huraira:
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."