This mosque, which was known as the Khazina library under the Soviets, was built by two Iranian workmen at the ex­pense of the local people in 1880. It is an ancient sample of oriental architectu­re. This building was in fact constructed on top of an Albanian historical monu­ment which belongs to the pre-Islamic period. In the early days of Islam, the temple operated as a centre inviting to Islam. Under Caliph Umar ibn Khattab, its scope of operation was even broa­der. As a result of Islamic propaganda in Azerbaijan, some Albanians adopted Is­lam. At that time, local Albanians rebuilt the Christian temple and turned it into a mosque. It used to have a five or six meter high roof.