Qazvin's historical background dates back to the Medes era, the 9th century BC. At that time, Qazvin was frequently attacked by tribes such as the Dialameh of Tabarestan. In the early years of the Islamic era Qazvin served as a base for the Arab forces. In the early Safavid period, Qazvin was selected as the capital. During the Qajar Dynasty and contemporary period, Qazvin has always been one of the most important governmental centers due to its proximity to Tehran. Prominent literary and social figures such as Obeid Zakani, Hamd Ol Lah Mostowfi, Mohamad Qazvini, Alame Qazvini, Alame Dehkhoda and Aref Qazvini (a talented poet of Constitutional Revolution era) and many others, were native residents of Qazvin.