About this time the Emir Nuh Ibn Mansur, prince of Khorassan, fell ill, and having heard of Avicenna's talent, sent for him and was restored to health under his treatment. As a reward, Avicenna was allowed to study in the prince's library, which contained several chests of rare manuscripts. Here he discovered treatises on the sciences of the ancients, and other subjects, the essence of which he extracted. It happened some time afterwards that this library was destroyed by fire, and Avicenna remained the sole depository of the knowledge which it contained. Some persons even said that it was he who had set fire to the library because he alone was acquainted with its contents, and wished to be their sole possessor.

At the age of eighteen he had completely mastered all the sciences which he had studied. The death of his father and the fall of the Samanide dynasty forced him to quit those literary treasures which he had learnt to appreciate so well. At the age of twenty-two he left Bokhara and went to Jorjan, the capital of Khwarezm where he frequented the Court of Shah Ali ibn Mamoun. At this time the celebrated Sultan Mahmoud of Ghazni, having heard that there were several learned men, and among them Avicenna, at the Court of Mamoun, requested the latter to send them to him. Several of them went, but Avicenna refused, probably because his orthodoxy was suspected, and Sultan Mahmoud was a strict Sunni. Mahmoud was much displeased at not seeing Avicenna appear at his court with the rest, and sent descriptions and drawings of him in several directions in order that he might be arrested. In the meantime, Avicenna finding the allowance made to him at the Court of Mamoun insufficient, left Jorjan and wandered through the towns of Khorassan. Finally he settled in a little village near Balkh. There he composed the greater part of his philosophical works, and among others the book on the "Eternal Principle and the Return of the Soul." Some time afterwards he was called to Hamadan to treat the Buwayhid Sultan Shams-ed Dawla, who suffered from a dangerous gastric malady. He was successful in curing the Sultan, who showed his gratitude by appointing Avicenna his vizier.

The affairs of State did not prevent Avicenna from carrying on his studies, for during his stay at Hamadan he found time to commence his exposition of the philosophy of Aristotle entitled the "Shifa" which he undertook at the Sultan's request. At this time Avicenna presented the rare spectacle of a philosopher discharging the functions of a statesman, without injury to either statesmanship or philosophy. His great physical energy enabled him to spend the day in the service of the Sultan and a great part of the night in philosophical discussions with his disciples. His writings, which date from this time, allow us to judge with what success he pursued his philosophical studies, and we have every reason to believe that he was equally successful in the conduct of affairs, for, after the death of Shams-ed-Dawla, his son and successor Taj-ed-Dawla requested him to retain the post of vizier.

Avicenna appreciated this testimony to his worth, but declined the offer in order to devote himself to the completion of his great work, the Shifa. But even in his studious retirement he was not out of reach of political disturbance. Suspected of carrying on secret correspondence with Ala-ed-Dawla, the governor of Ispahan, an enemy of Taj-ed-Dawla, Avicenna was imprisoned in a neighbouring fortress. He would probably have remained there a long time had not the fortune of war put Ala-ed-Dawla in possession of Hamadan, Avicenna was liberated after an imprisonment of four months. Despite this misadventure he succeeded during his stay at Hamadan in completing the Shifa and several medical treatises, besides, a little mystical allegory, "Hay ibn Yokdhan" ("The living one, son of the Waking One"). This shows the mystical side of Avicenna's philosophy, and we therefore subjoin an abridgment and explanation of it.

"During my sojourn in a certain country, I used to make excursions with my friends to pleasant spots in our vicinity. One day when strolling out with them I met an old man who, in spite of his advanced age, seemed brimful of juvenile ardour, being neither bent nor having white hairs. We felt attracted by him and accosted him. After the usual salutations, I opened the conversation by requesting him to inform us about himself, his trade, name, family, and country. 'As to my name and family,' he answered, 'I am called Hay ibn Yokdhan, and I was born in Jerusalem; as to my occupation, it consists in traversing all the regions of the earth, always following the direction indicated by my Father. He has entrusted to me the keys of all the sciences and guided me through all ways even to the utmost bounds of the universe.' We continued to ask him questions regarding different branches of science till we touched on the science of physiognomy, on which he spoke with marvellous precision, taking it as the starting point of a discourse which he delivered to us."

This exordium may be interpreted as follows: "During the sojourn of my soul in the body I felt a desire under the guidance of my imagination and my senses to examine whatever presented itself to me. While thus engaged, I came in contact with active Intelligence (the old man), the salutary effects of which I had long experienced and which had preserved my vigour unabated. I commenced to examine the nature of this Intelligence freed as it is from all material grossness and yet in a certain way, linked to the material world. Since life includes the two conditions necessary to actual development, consciousness and movement, he calls himself 'Hay' 'the Living,' and adds 'ibn Yokdhan' 'Son of the Waking,' meaning that he derives his origin from a Being higher than himself, Who is always awake and has no need of repose. His birthplace is the holy city of Jerusalem, free from all earthly stain, and his occupation is to traverse the highest regions open to intelligence in order to understand the nature of his heavenly Father, who has committed to him the keys of all forms of knowledge. Thus, favoured by his help, we arrive at Logic, a science which leads by sure and evident conclusions to a knowledge of what is remote and occult. For this reason logic is indicated by the term 'physiognomy' which judges of the hidden by its outward manifestation."

After this commencement the allegory proceeds: "Logic," continued the old man, "is a science whose income is paid in ready money; she brings to light what nature conceals, and what may be a source of either joy or sorrow; she points you out the way of freedom from earthly entanglements and sensual propensities. If her healing hand touches you, it will give you salutary support, but if your weakness cause you to stumble, you will be exposed to ruin, accompanied as you always are by bad companions[35] from which it is impossible to get free.

"As to thy nearest companion (imagination), he is a confused babbler, abounding in futility and falsity; he brings you news in which truth and falsehood are mingled together, and that, though he professes to be your guide and enlightener. He often brings matters before you very ill-suited to your dignity and position, and you must be at the pains of distinguishing the false from the true in them. But for all that, he is very necessary to you, and would exert a healthy influence on you, if his false witness did not lead you into error.

"But your companion on the right (irascibility) is still more impetuous, and it is only with the greatest difficulty that his attacks can be repulsed by reason or avoided by dexterity. He is like a blazing fire, a rushing torrent, a runaway horse, or a lioness deprived of its young. Similarly with your left-hand companion (carnal concupiscence) whose evil influence springs from insatiable appetite; he is like a famished beast let loose to graze. Such are your companions, unhappy mortal, to whom you are tied, and from whom no release is to be obtained except by migrating to those countries where such creatures are unknown. But till you are allowed to do so, your hand at any rate must tame them; beware of flinging the rein on their necks and giving them free course; if you hold the reins tight they will submit, and you will be master."

"After I had heard this description of my companions, I began to recognise the justice of it, and accordingly I varied gentleness and severity in my treatment of them. Alternately I and they had the upper hand. But I constantly invoked the help of God in this respect, until I was delivered. Meanwhile I prepared for the journey, and the old man added this last counsel: 'You and those like you will be constantly impeded in this journey, and the road will be very difficult for you, unless you can succeed in quitting this world for ever; but you cannot hasten the time fixed by God. You must therefore be content with a frequently interrupted progress; sometimes you will make way, sometimes you will be at the beck and call of your companions. When you apply yourself with your whole heart to making progress, you will succeed, and your companions will lose all influence over you; but if you connive at their importunities, they will conquer you, and you will altogether lose touch with me.'