The ʿafārīt are often associated with the underworld and identified with the spirits of the dead, and have been compared to evil geniī loci in European culture.
In later folklore, they developed into independent entities, identified as powerful demons or spirits of the dead who sometimes inhabit desolate places such as ruins and temples.
[3] The word ifrit appears in Surah an-Naml: 39 of the Quran, but only as an epithet and not to designate a specific type of demon.
[2][4] The term itself is not found in pre-Islamic Arabic poetry, although variants such as ifriya and ifr are recorded prior to the Quran.
After Iblis gains permission to test Job, he descends to earth and summons his most powerful devils (shaytan) and ifrits.
[15] In Islamic folklore, the afarit became a class of chthonic spirits, inhabiting the layers of the seven earths,[16][17] generally ruthless and wicked, formed out of smoke and fire.
[b][18] Despite their negative depictions and affiliation to the nether regions, afarit are not fundamentally evil on a moral plane; they might even carry out God's purpose.
[24](pp103–104) Probably influenced by the Ancient Egypt idea of Ka, the afarit are often identified with the spirits of the dead, departing from the body at the moment of death.
[28] Their physical appearance is often portrayed as having monstrous deformities, such as claw-like or thorny hands, flaming eyes or seven heads.
[28] A story circulates among the Shabak community in Northern Iraq about a certain ifrit who incensed Ali by his evil nature long before the creation of Adam.
[30] Nizami Ganjavi (c. 1141–1209) narrates in his Haft Peykar the story of the Egyptian wayfarer Māhān (the "moonlike one") and his travels to a demon-infested desert.
[31] Māhān's horse, presented to him by a demon in human disguise, gallops his rider into the desert, where it turns into a seven-headed monster.
When a beautiful girl with the face of a parī (fairy) enters the room, Māhān is overwhelmed by his lust and passion and ignores the order of the old man.
While the beauty of his desire embraces Māhān, the girl suddenly turns into an ifrit, formed from God's wrath.
In one tale called "The Porter and the Young Girls", a prince is attacked by pirates and takes refuge with a woodcutter.
Later a princess restores the prince and fights a pitched battle with the ifrit, who changes shape into various animals, fruit, and fire until being reduced to cinders.
[41] In both the novel American Gods (2001) and the television adaptation by Neil Gaiman an ifrit disguised as a taxi-driver appears, trying to get used to his new role, seeking intimacy in a lonely world.