were offered the same terms as Abhar had earlier, but the people of Qazvin did not want to pay jizya and supposedly accepted Islam instead. Al-Bara' then used Qazvin as a base for further campaigns into Daylam and Gilan. Later, when Sa'id ibn al-'As was appointed governor of Persia under the Umayyads, he built a new town called Hājjāj at Qazvin. Two more new cities were founded at Qazvin during the late 8th century. The Abbasid caliph Musa al-Hadi founded a new city called Mādina Mūsā next to Hājjāj. He bought nearby Rustamābād and designated it as a waqf for the benefit of the new town. His freedman Mubarak, a Turk, also founded a new town at Qazvin in 792/3 (176 AH), called Mubarakābād after himself. Harun al-Rashid visited Qazvin while on his way to Khorasan and saw firsthand the locals' struggles as a result of the Daylamite raids. At the same time, he was impressed by their efforts to fend off the Daylamites. Harun suspended Qazvin from having to pay the kharaj tax and instead ordered an annual payment of 10,000 silver dirhams. He had a wall constructed around the new cities of Mādina Mūsā and Mubarakābād and also built a congregational mosque in the city, and he endowed several buildings as a waqf to support the mosque. The mosque no longer exists today. Harun's wall was not completed until 868, over half a century after his death. It had 206 towers and 12 gates and was built out of mud brick except for the battlements and gates. When it was finished, more people began to settle in Qazvin. Its population was heavily Arab during this time. Qazvin remained an important frontier town during the wars between the Abbasid caliphate and the Alid rulers of the Caspian. The caliph al-Mu'tasim appointed Fakhr al-Dawla Abu Mansur Kufi as governor of Qazvin around 838; he remained governor for the next 40 years. For a couple of years around 865/6, the Alids under Hasan ibn al-Bakir took control of Qazvin, and Fakhr al-Dawla continued to serve as governor under them. Qazvin briefly came under Samanid rule in 905/6 (293 AH) when Ilyas ibn Ahmad became governor. The next year, though, the governorship passed to Fakhr al-Dawla Abu Ali, an ancestor of Hamdallah Mustawfi, and he served as governor for the next 27 years. In 913/4 (301 AH) Qazvin was put under Ali