For a more thorough study of the religious context around the Maiden Tower the archaeologist F. Ibrahimov carried out excavation works (1990-93) and a mosque dated back to the IX century was found to the north of the Tower. Short-term archeological excavations done in this area in 1988  revealed the existence of another 2 rooms.

During the excavations continued in the floor of the larger room a  mehrab (pulpit) within an arched niche was found in the western wall close to its southwestern corner. On the top of the mehrab is a two-word Arabic inscription in Cufic writing. The inscription was read by the researcher -epigrapher  Mashadikhanum Nemat. The inscription says: "All Power resides with Allah". Based on the comparative analysis and handwriting specifics, the researchers attribute this inscription to VIII-IX centuries. The mosque, the adjoining premises, and the arcade give grounds for supposing that were incorporated into a single complex. Given that the city was located on a commercial-  caravan rote it also a guess may be given on existence of a Khanegah (place for dervishes) in this area. The historian archaeologist F. Ibrahimov believes this mosque is the mosque of a distinguished theologian and clergyman, Bakuvian by birth (born in Baku), Baba Kuhi Bakuvi.