Persian mystical literature is watered by the fountain of principles and foundations of Islam. However, some common themes in mystical texts are not compatible with the spirit of the original teachings of Islam. Pre-Islamic mystical beliefs such as Jewish mysticism, Gnosticism, ancient Iranian mysticism, Manichaeism, and Mandaeism have been influential in the formation of some of these themes. One of the most important themes is the captivity of the soul in the prison of the body and the well of the world. The essence of this theme has been prevalent in the age of mythology in some form and after passing through philosophy and the texts of the Old Testament, it has reached pre-Islamic mysticism. The most obvious characteristic of pre-Islamic mysticism is the belief in the captivity of light. Muslim commentators and mystics have assumed this topic to be appropriate with the content of some verses and traditions and have created themes around it. In this article, the roots of this theme in mythology and mystical beliefs before Islam are examined and its manifestation is represented in the form of the image of "prison and well" in Persian mystical literature.