Islamic psychology or ʿilm al-nafs (Arabic: علم النفس), the science of the nafs ("self" or "psyche"), is the medical and philosophical study of the psyche from an Islamic perspective and addresses topics in psychology, neuroscience, philosophy of mind, and psychiatry as well as psychosomatic medicine.
Concepts from Islamic thought have been reexamined by Muslim psychologists and scholars in the 20th and 21st centuries.
In the writings of Muslim scholars, the term Nafs (self or soul) was used to denote individual personality and the term fitrah for human nature. Nafs encompassed a broad range of faculties including the qalb (heart), the ruh (spirit), the aql (intellect) and irada (will). Muslim scholarship was strongly influenced by Greek as well as by the study of scripture, drawing particularly from Galen' understanding of the four humors of the body.
In medieval Islamic medicine in particular, the study of mental illness was a speciality of its own, and was variously known as al-‘ilaj al-nafs (approximately "curing/treatment of the ideas/soul/vegetative mind), al-tibb al-ruhani ("the healing of the spirit," or "spiritual health") and tibb al-qalb ("healing of the heart/self," or "mental medicine").
The Classical Arabic term for the mentally ill was "majnoon" which is derived from the term "Jenna", which means "covered". It was originally thought that mentally ill individuals could not differentiate between the real and the unreal. However, due to their nuanced nature treatment on the mentally ill could not be generalized as it was in medieval Europe  This term was gradually redefined among the educated, and was defined by Avicenna as "one who suffers from a condition in which reality is replaced with fantasy".
In the Islamic world, special legal protections were given to the mentally ill. This attitude was reinforced by scripture, as exemplified in Sura 4:5 of the Qur'an:
Do not give your property which God assigned you to manage to the insane: but feed and clothe the insane with this property and tell splendid words to them.— "
This Quranic verse summarized Islam's attitudes towards the mentally ill, who were considered unfit to manage property but must be treated humanely and be kept under care by either a guardian or the state.
This belief was similar to that of modern psychology, specifically to Sigmund Freud's beliefs that the mentally ill require help and treatment, as opposed to how society dealt with the mentally ill before modern psychology.
Muhammad ibn Zakariya al-Razi (865 – 925), known as Rhazes in the western tradition, was an influential Persian physician, philosopher, and scientist during the Golden Age of Islam, and among the first in the world to write on mental illness and psychotherapy. As chief physician of Baghdad hospital, he was also the director of one of the first psychiatric wards in the world. Two of his works in particular, El-Mansuri and Al-Hawi, provide descriptions and treatments for mental illnesses.
Abu-Ali al-Husayn ibn Abdalah ibn-Sina (980-1030), known to the west as Avicenna, was a Persian polymath who is widely regarded for his writings on such diverse subjects as philosophy, physics, medicine, mathematics, geology, Islamic theology, and poetry. In his most widely celebrated work, the Canon of Medicine (Al-Qanun-fi-il-Tabb), he provided descriptions and treatments for such conditions as insomnia, mania, vertigo, paralysis, stroke, epilepsy, and depression as well as male sexual dysfunction. He was a pioneer in the field of psychosomatic medicine, linking changes in mental state to changes in the body.
The earliest bimaristans were built in the 9th century, and large bimaristans built in the 13th century contained separate wards for mentally ill patients.
In addition to medication, treatment for mental illness might include baths, music, talk therapy, hijama (cupping), and aromatherapy. Scholars and physicians of this time period were some of the first to emphasize psychosomatic medicine, the emphasis placed on the relationship between illness of the mind and problems in the body. Medicine would be prescribed in order to re-balance the four humors of the body, an imbalance of which might result in psychosis. Insomnia, for example, was thought to result from excessive amounts of the dry humors which could be remedied by the use of humectants.
|year= / |date= mismatch(help)