Sultan Mahmúd towards the latter part of his reign was frequently dissatisfied with Khwája Ahmad, and during this time his enemies were assailing him with their calumnies and opposition. Khwája Hasnak Mishkátí* had been many years watching to find a suitable opportunity of injuring him, and every day it was rumoured that Khwája Ahmad Hasan's place was to be bestowed on him, but as the King's new bride, the daughter of the Khán of Turkistán,* was in Ahmad's favour, nothing could be done against him. This lady was called in Ghaznín Mahd-i Chigil, and Jamíla Kandahárí was one of her favourite attendants. Under the protection of this lady the Khwája was safe from all dangers. Even such a person as Altúntásh, who was viewed as vicegerent of Subuktigín, could never succeed in any hostile design against him.
On one occasion, when the tents of the Sultán were pitched in the vicinity of Kábul, Khwája Ahmad came on some government business to Ghaznín, and it was reported to him that some merchants were going to Turkistán, who were to return to Ghaznín in the beginning of winter. The Khwája remembered that he required a certain number of postíns (great coats) every year for himself and sons, and thought it advisable that some agent should go with the merchants to effect the purchase. To this man's care he committed many valuable and rare commodities of Ghaznín to sell. The same day this news was conveyed to Khwája Hasnak by his spies, and he informed Altúntásh of it. This noble was much rejoiced on receiving the intelligence, and he told Khwája Hasnak that they “could not have found a better opportunity for disgracing him, since he always boasted that he never looked to his own advantage, but to that of the Sultán alone; whereas he is now sending merchants to trade in foreign countries. But we must ascertain this with certainty first, lest the disgrace recoil upon us.” Khwája Hasnak said, “the report is perfectly true, and there is no doubt about its correctness; and verily if this fact were disclosed, the Khwája must suffer irremediable ruin.”
The Khwája being apprised of their intentions, informed Jamíla Kandahárí of the matter. There was such friendly communication between the Khwája and Jamíla, that although it often happened that during a whole year they never had an opportunity of seeing each other, yet one could send messages to the other ten times a day, and in such a manner that, excepting the person employed on their mission, nobody knew anything of the matter. In short, Jamíla sent to tell him not to be afraid, because the remedy was very simple. At the same time she repaired to Mahd-i Chigil, and represented the matter to her, suggesting that the Queen should write letters to her mother and brothers, with a detail of the articles which the Khwája had given to the merchant, and add others that were suitable as presents to her royal relatives, mentioning that they were sent as presents on her part, and requesting that they also would send in return some articles of such kinds as were adapted to a female toilette. Jamíla recommended that these letters should be taken to the merchant as soon as possible by some unfrequented road, so that they might be given to him that very night, with the injunction that if the servants of Altúntásh should seize and carry him back, he should say nothing to them, but when conducted to the royal court, he should then declare that he was sent by Mahd-i Chigil, and show the letters and presents which he was commissioned to deliver.
In short, at the instigation of Khwája Hasnak, Altúntásh represented the case to the Sultán, who asked him whether it was a true report. Altúntásh replied that he had ascertained it for certain, and that it was all correct. The King then asked him how he knew that it was true? Altúntásh replied, “If you order me, I can bring the merchant with all the articles which are consigned to him.” The King consented. On this Altúntásh immediately despatched his people after the caravan, and they brought the merchant back. According to the instructions. the merchant said nothing to his detainers on the way, but when he entered the court he cried out, that he was sent by Mahd-i Chigil, and then showed the letters under her seal, with the presents which had been despatched, such as scarfs, necklaces, etc. The informers were much chagrined and ashamed, and could advance no excuse for what they had done. On the other hand, Mahd-i Chigil complained to the King that, when after so long a period she had sent from the court of such a great king some trifling presents to her relations, her messenger had been intercepted, and the scarfs and necklaces exposed in open court. By such words she produced great effect upon the King's mind, and with much indignation he ordered the accusers to be put to death; but as Mahd-i Chigil knew that they were innocent, she was unwilling that the blood of so many persons should be shed through her false representations, and begged that their lives might be spared. In short, Altúntásh and Hasnak received a complete defeat, and were covered with ignominy and shame; while the merchant, after being much honoured, was again despatched to Turkistán.
Sultán Mahmúd was always on bad terms with his eldest son Mas'úd; and Khwája Ahmad, although he was unable completely to reconcile them, yet on all occasions he greatly appeased the King's anger. Though he never met the prince except about once a year in the King's presence, he nevertheless did not cease to exert his friendly offices.
When Khwája Ahmad was dismissed, Khwája Hasnak Mishkátí was appointed in his place. This person was a youth of no experience, and but little acquainted with the vicissitudes of the world. His chief attractions were the sincerity of his heart, the affability of his manner, and the readiness with which he served a friend or chastised an enemy. Though the Sultán was in reality disgusted with Mas'úd, yet this secret sentiment remained concealed till the time that he declared his son Muhammad his heir. Hasnak was not in favour with Mas'úd, since, in accordance with the custom of Díwáns, he interfered greatly with the rights and privileges of his princely appanage. Mas'úd was so angry with him in consequence, that when one of the rulers of India sent a sword as a present to him, the person who brought it, expatiating on its value, observed that it was so sharp and well-tempered, that even iron could not resist it. When the assembly was broken up, the prince asked his intimate companions what particular use it was adapted for? Some said it was to cut off infidels' heads, and others observed that it was to destroy his Majesty's enemies. In this manner every one expressed his own opinion; but Mas'úd observed, that he would like to fasten it to his side, and when, on the morrow, Hasnak came to pay his respects to him, to cleave his head with it down to his breast. If I were to do this, the King would never demand my blood in retaliation for his murder. He said this in a determined tone, but those who were present dissuaded him, and remarked that a great disturbance would ensue, and the Sultán would be very angry. When the Khwája was informed of what the prince had resolved, he thanked God for his narrow escape.
A short time after this, Sultán Mahmúd expired, and Sultán Muhammad occupied the throne of sovereignty in Ghaznín. Sultán Mas'úd at this time was in Isfahán, whence he returned with all speed. Sultán Muhammad advanced to oppose him, but the ministers of Mahmúd's court, considering that Mas'úd was much better adapted to wield the sceptre of the kingdom, seized Sultán Muhammad, and kept him prisoner in a fort. They then proceeded as far as Hirát to welcome Mas'úd. At the meeting, when Hasnak dismounted from his horse, the attendants of the prince seized him, and suspended him from a gibbet. They then summoned Khwája Ahmad Hasan, and having entrusted him with the office of wazír, bestowed all kinds of honour on him. Although his ministry was not of long duration, yet it was very successful in its results. He was often heard to say, “Thank God, affairs have reached this conclusion; my friends are exalted, and my enemies crushed.”*