After the siege of Esfahan in 1134 A.H. by Mahmud Afghan , with the recommendation of Mohammad Qoli Khan Shamlu , the grand vesir , and Mohammad Aqa-ye-Khwajeh Uzbashi, this decision was taken that the third son of Shah Sultan Husein (Tahmasb Mirza) along with Ismail Aqa-ye-Khwajeh Jubbahdarbashi (the tutor) , Mohammad Ali Khan the son of Aslan Khan Mohammad Alikhan, the rifle keeper, Rajab 'Alikhan the previous overseer, Mirza Sadeq, the Annals writer, and some of special servants along with Haji Hashem Tabrizi 200 men from Tabriz set out to Azarbayjan in 22nd Shaban 1134 A.H./ 1722 A.D., secretly.Tahmasb Mirza along with his men, after passing Kashan intered Qazvin and settled there in Dawlat-khaneh. It is said that the hopeless people of Qazvin showed a great happiness and inspite of being afraid of the situations, welcomed Tahmasb and his men in the city, without thinking this fact that these people could not solve their problem with the Afghans. In the 30th of Moharram in 1135 A.H., instead of taking care of Qazvinians and their problems , became deaf and blind , started amusing themselves by feasting and taking drinks.After receiving the news from Qazvin, Mahmud Afghan sent his commander 'Aman Allah Khan along with Ashraf, his cousin, to destroy Tahmasb and his men. On the other hand, by hearing the attack of Afghan in Qazvin, Tahmasb with his men ran away towards Tabriz and left the people of Qazvin alone in the hands of Afghans.The people of Qazvin had no alterative but to accept the invaders into the city and settling them in their houses. After a few days, seeing their bad behaviors, attitudes and demands, revolted against them. Some of the Afghans were killed and the rest ran away Esfahan. Seeing the withdrawal of Afghans, Mahmud became furious and killed many Esfahanians.
This uprising of Qaznavians was the first uprizing against Afghan invaders in Iran and became the first example which was followed by other cities in Iran. Specially in Esfahan which caused Mahmud's death and the final falling of Afghan power in Iran.