In the Book of God (Ilahi-nama) 'Attar framed his mystical teachings in various stories that a caliph tells his six sons, who are kings themselves and seek worldly pleasures and power.
The first son is captivated by a virgin princess, and his father tells him the adventures of a beautiful and virtuous woman who attracts several men but miraculously survives their abuse and then forgives them. They acknowledge that carnal desire is necessary to propagate the race but also recognize that passionate love can lead to spiritual love, which can annihilate the soul in the beloved.
Other stories indicate the importance of respecting the lives of other creatures such as ants or dogs. One only thinks oneself better than a dog because of one's dog-like nature.
The second son tells his father that his heart craves magic; but his father warns him against the work of the Devil. A monk tells a shaikh that he has chosen the job of locking up a savage dog inside himself, and he advises the shaikh to lock up anger lest he be changed into a dog. The father suggests that this son ask for something more worthy and tells an anecdote in which Jesus teaches a man the greatest name of God. The man uses it to make bones come alive into a lion, which devours him, leaving his bones. Jesus then says that when a person asks for something unworthy, God does not grant it. Birds and beasts flee from people, because people eat them. God tells Moses to watch his heart when he is alone, to be kind and watch his tongue when he is with people, the road in front when he is walking, and his gullet when he is dining. A saint tells a shaikh that love is never denied to humans, for only the lover knows the true value of the beloved. Another saint warns that unless you pray for protection from negativity (the Devil), you shall not enter the court of God.
The third son of the caliph asks for a cup that could display the whole world. 'Attar concluded a story by saying that Sufism is to rest in patience and forsake all desire for the world, and trust in God means bridling one's tongue and wishing for better things for others than for oneself. This son asks why his father seems to disparage the love of honor and the love of wealth which all seem to possess. The caliph replies that in the crazy prison of the world one can achieve greatness only by devotion. Since one speaks to God through the heart and soul, it is difficult to speak with God of worldly things. The third son asks if he can be allowed to seek power in moderation; but the father still warns that this will place screens between him and God. Each screen created by seeking power will create more screens. One must see both the good and the bad inside and outside oneself to understand how they are connected together. Saints who reach their goal see nothingness in all things, making sugar seem like poison and a rose like thorns. Ayaz advises the conquering sultan Mahmud to leave his self behind since he is better being entirely We. In the last story for his third son, the father says that thousands of arts, mysteries, definitions, commands, prohibitions, orders, and injunctions are founded on the intellect. What cup could be more revealing than this?
The fourth son seeks the water of life, and his father warns him against desire. A wise man considers Alexander the Great the slave of his slave, because the Greek conqueror has submitted to greed and desire, which this wise man controls. If the son cannot have the water of life, he asks for the knowledge that will illuminate his heart. In one story 'Attar concluded that if you are not faithful in love, you are in love only with yourself. The fifth son asks for the ring of Solomon that enables one to communicate with birds and other animals. The Way is summarized as seeing the true road, traveling light, and doing no harm. The father tells this son that he has chosen an earthly kingdom, because he has not heard of the kingdom of the next world. He advises this king that since his sovereignty will not endure not to load the whole world on his shoulders. Why take on the burden of all creation? The caliph suggests that his son practice contentment, which is an eternal kingdom that overshadows even the Sun. When Joseph was thrown into a pit, the angel Gabriel counseled him that it is better to notice a single blemish in yourself than to see a hundred lights of the Unseen.
The sixth son desires to practice alchemy, but his father perceives that he is caught in the snare of greed. Gold is held more tightly by a miser than the rock grips the ore. The son observes that excessive poverty often leads to losing faith, and so he asks God for both the philosopher's stone and for gold; but his father replies that one cannot promote both faith and the world at the same time. In the epilog the poet commented that since he receives his daily bread from the Unseen, he does not have to be the slave of wretched men, and 'Attar concluded this work with the satisfaction that he has perfumed the name of God with his poetry.