The mosque was built in the 1890s by philanthropist Haji Hajibaba. The mosque remained closed after the Bolshevik revolution for some time. However, it was reopened later and renovated after Azerbaijan regained its independence.
One of the oldest mosques in Azerbaijan, Imam Huseyn, has undergone major repairs and restoration in 2017 with the support of the Heydar Aliyev Foundation. The architectural style of the building has been preserved and the area renovated. The area of the mosque is 300 square meters. It can serve up to 400 people at the same time. A 130-member ceremony hall was also built on the territory of Imam Hussein Mosque.