Meanwhile, Muhammad Shah returned from his unsuccessful campaign against Herat in 1254/1838, therefore, the Aga Khan was allowed to proceed to Tehran towards the end of 1254/1838. He presented his case before the king with innumerable evidences of his loyalty. T. MacKenzie, the British envoy, however, reported from Kharrak to the Secret Committee that, 'The Aga Khan was induced to surrender himself under solemn promises which were shamefully violated by the Persian government, and instead of being restored to his government, he was kept a prisoner at Tehran at the king's camp.' Finally, the Aga Khan was made free provided he retired peacefully to his family lands at Mahallat. It should be known that Mahallat means mahallas (quarters) of a town, which consisted of three separate villages. After a brief stay in Qumm, he did retreat to Mahallat, where he built a large fortified residential compound for his family and numerous dependents and pages.
Assured of his safety, the Aga Khan however found that he was being socially ostracised by the orders of his implacable enemy, Mirza Aqasi, and had to fight even for food. This fresh provocation embittered the situation. In the meantime, once again the cloud of rumours began to thicken in Tehran that the Aga Khan had built a palace with a huge army to extend his influence in southern Iran. It was exaggerated and ultimately took the shape of a report that the Aga Khan intended to rebel against the Qajarids. The Aga Khan, however, led a tranquil life at Mahallat for about 2 years following his dismissal from the governorship in Kirman. Early in 1256/1840, Muhammad Shah himself went to Dalijan near Mahallat on the pretence of recreation, to verify the truth of the rumours. At that time the Aga Khan was out of Mahallat for hunting. He however, sent his messenger to Mirza Aqasi, requesting for royal permission to proceed to Mecca for pilgrimage. Permission was granted and a first batch of Aga Khan's family including his mother and son were sent to Iraq. He himself then moved from Mahallat for ever in Rajab, 1256/September, 1840 with his brothers, nephews, and a number of relatives, dependents and followers.
The Aga Khan reached Yazd after leaving Mahallat. It is reported in Riach's diary of September 25, 1840 that, 'Bakhsh Ali Khan from Shiraz came to siege the Aga Khan, but he was defeated by the followers of the Aga Khan. Muhammad Shah, the king who was at that time in Ispahan, also sent two messengers to arrest the Aga Khan. The Aga Khan ordered both hands of one of them to be cut off which was done, the other by entreating mercy was not injured.' When the Aga Khan was on the borders of Kirman and Yazd, Bahman Mirza Baha ad-Dawla, the governor of Yazd, and the brother of the king, attacked with the royal force on Aga Khan's caravan, but was defeated in his incursion. Robert Grant Watson writes in 'History of Persia' (London, 1866, p. 333) that, Bahman Mirza had divided his force into three parts and thus gave an opportunity to the Aga Khan to defeat each detachment in detail. Among the first troops of Bahman Mirza, there were many who secretly held the tenents of Ismailis, the rest was that in the action which ensued, they went over in a body to Aga Khan, and their leader Isfendiar, was killed.
Several other skirmishes were also won by the Aga Khan before he arrived in Shahr-i Babak with the help of the local Ismailis. The citadel of Shahr-i Babak was in the hands of Kuhindil Khan of Kandhar, the governor of Shahr-i Babak, who had sought refuge in Iran in 1839 after the British invasion of Afghanistan. The Aga Khan, reinforced by a bulk of Ataullahi Ismailis, besieged Shahr-i Babak, forcing the Afghans to surrender.
By the end of 1840, the southern Iran had become a bed of hatching rebellions. It was however rumoured that an Iranian prince Suleman Mirza, residing at Baghdad, had arrived in Kirman to assist the Aga Khan. Even Ali Shah, the king's uncle, who was spreading his influence in the mountains of Fars, was also in contact to this effect with the Aga Khan. Muhammad Taki Khan, the chief of the Bakhtiyari tribe, and the governor of Khuzistan, also generated close ties with the Aga Khan with a view to help him against the Iranian empire. Meanwhile, Muhammad Shah failed to get his revenue in advance from Muhammad Taki Khan, and accused him of having supplied the Aga Khan with his means and resources, therefore, he was replaced by Ali Naqi Khan to the governorship. A.H. Layard, on the other hand writes in 'Early Adventures' (London, 1887, p. 322) that, when he was in the mountains, he received news that the Aga Khan was also supported by the British government. In sum, there is no foundation to believe that the Aga Khan had ever acquired aids from the rebellions of the southern Iran, or the British authority to engineer the so called rebellion against the Iranian empire. In December 31, 1841 after resuming his office in Tehran, the British agent McNeill had written to Aberdeen that, 'It may be almost unnecessary for me to add that the charges brought against the British government or its agents, of having secretly aided the Aga Khan, are without foundation, and the Persian government must have been deceived by its informants.'