Since 3000 BCE, in the time of the Babylonians and Egyptians, some people considered to be “mentally abnormal” were thought to be plagued by demons. Indeed, between the years 200 and 1700, almost all mental illnesses were considered to be caused by possession. However, instead of cutting into people’s heads to let the bad spirits out, exorcism was used instead.
In Mesopotamia, priests used religious rituals to cast the demons out, and by the Middle Ages, the steps of an exorcism were clearly delineated. First, a priest would try to coax the demon out. If that didn’t work, they would insult the demon. If the ritual was still unsuccessful, the possessed person would be made so physically uncomfortable (i.e. immersed in hot water or subjected to sulfur fumes) that the demon would not want to stay within them.
However, whether or not an exorcism works seems to depend solely on the attitude of the possessed person. If they believe themselves to be possessed, and that an exorcism will help them, it probably will. As for a long-term solution? Unless the patient is willing to use exorcism like continuous therapy, it’s doubtful that they’ll remain “cured.”