The Djinn, also known as the Jinn, the Djinns, the Jinns, Djinnies and Jinnies, are ancient, supernatural beings that have their roots in Arabic mythology and later Islamic tradition would describe them as a race of spirits that much like humans could be either good, bad or neutral and tended towards their own society and norms.
In the modern age the Djinn have become an immensely popular archetype in Western media, often simplified into their alternate name: the Genies.
Although in legend the Djinn were considered equal to humans in later additions to the lore they gained specific traits that have now become firmly associated with "genies", such as being bound to a worldly item (usually a lamp or jar) and being forced into granting three wishes to whoever sets it free.
One trait that remains fairly similar to their ancient past is the Djinn's ability to be either benevolent, neutral or malevolent - evil "genies" tend towards horrific features akin to demons, intensely vicious habits (such as murder and torture) and a tendency to either outright deny those that set them free wishes or twisting the wishes in a manner that is designed to harm the user (unlike a neutral djinn the malevolent ones deliberately harm their foolish "masters" rather than simply grant a wish "literally").
If one was unfortunate enough to free a malevolent Djinn it was possible to defeat the spirit, much like Folk Devils the Djinn could never be outmatched by force and any hero who wished to survive would have to act quickly to secure victory, using their wit to play the Djinn's often prideful nature against it.
A common trick used against a malevolent Djinn was to play into its need to show how powerful it was, tricking the spirit into re-entering his lamp (or jar) and then sealing it - trapping the demon within before he could return to cause harm to his summoner.
If an evil Djinn was not contained he could unleash terrible plagues upon the world - usually this did not happen as stories involving malevolent Djinn tend to always end in the monster being contained in his jar / lamp (in some rare stories the Djinn may even be destroyed completely (this is not common as Djinn are usually portrayed as spirits and thus completely immortal).