Abhar

[7] Abhar has served as a vital spot since antiquity due to its location on the route that links Dinavar to Qazvin and Zanjan as well as the central areas of Iran to the region of Azerbaijan.

The inhabitants of Abhar initially put up a fierce fight which lasted for several days, but eventually sued for peace, which the Arabs agreed to.

[7] In 916 or 917, Abhar (along with Zanjan, Qazvin, and Ray) was seized from the Samanids by the Sajid Yusuf ibn Abi'l-Saj (r. 901–928), the virtually independent governor of the caliphal provinces of Azerbaijan and Armenia.

[7] In 928, Abhar was briefly seized by the Alid ruler of northern Iran, Abu Muhammad Hasan ibn Qasim.

[7] In 997, the ruler of the Daylamite Sallarid dynasty, Ibrahim II ibn Marzuban II, capitalized on the weak rule of the Buyid ruler Majd al-Dawla (r. 997–1029) by briefly seizing Buyid land in Jibal, including Abhar, Zanjan and Sohrevard.

Supported by soldiers sent by the Khwarazmshah Ala al-Din Tekish (r. 1172–1200) of the Anushtegin dynasty, Inanaj ran rampant in the town, capturing the women and children before going back to Khwarazm.

He commended the produce of the town, which encompassed of grain and large amount of fruits, especially the Sijistani pears, Bu Ali plums and black cherries.

He also reported that the residents of Abhar had fair skin and were adherents of the Shafi'i school, and that the grave of Shaykh Abu Bakr ibn Tahir al-Tayyar al-Abhari was located there.

Abhar's ancient origins are further demonstrated by the fact that it is linked by Islamic-era writers to mythological and semi-mythical individuals in Kayanian era.

According to Hamdallah Mustawfi, Nushtagin Shirgir Saljuqi's descendant Baha al-Din Haydar constructed the Haydariyya castle on the location of a fortress.