Abu Hurairah reported,

The Prophet ﷺ said, "An ifrit from among the jinn came at me suddenly last night," or words to that effect, "trying to interrupt my prayer. But Allah gave me power over him, so I seized him and intended to tie him to one of the pillars of the mosque so that all of you could look at him in the morning. Then I remembered the supplication of my brother Sulayman, 'My Lord, forgive me and grant me a kingdom such as will not belong to anyone after me' [Sad 38:35], so I sent him away humiliated."Ifrit means a rebellious one from among humans or jinn, like zibniyah, whose plural is zabaniyah.

Azami 2655

Sahih

عن أبي هريرة

عن النبي ﷺ قال: إن عفريتا من الجن تفلت علي البارحة- أو كلمة نحوها- ليقطع علي صلاتي. فأمكنني الله منه فأخذته فأردت أن أربطه على سارية من سواري المسجد حتى تنظروا إليه كلكم. فذكرت دعوة أخي سليمان: {رب اغفر لي وهب لي ملكا لا ينبغي لأحد من بعدى} [سورة ص: ٣٥] فرددته خاسئا. عفريت: متمرد من إنس أو جان مثل زبنية جماعتها الزبانية.

الأعظمي 2655صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Minor actions do not invalidate the prayer
Section
Repelling the jinn and strangling it during prayer
Numbering
Jami al-Kamil 2655 (2nd edition)
Azami 2655