The precise history and function of the building is controversial. Historically, Keygubad mosque was a building of mosque-madrasa which was adjacent to Darvish tomb. Abbasgulu Bakikhanov wrote about Bakuvi on his teaching and worshipping in the mosque:
“His prayer room, his school and his grave is in there – in the mosque.”
Shirvanshah Keyqubad I was in power in 1317–48. According to prominent researcher, S. Ashurbeyli, Keyqubad was grandfather of Sheikh Ibrahim.[1]
During 1918 events the mosque was burnt by Armenian troops.[2]:102
In the southern part of the lower courtyard of the Shirvanshahs Palace, only the remains of the foundation and a few arches of Keygubad mosque are left.
Architectural features
The mosque consists of a rectangle worshipping hall and a corridor in front of it. Originally on the center of the hall, there used to be 4 columns to hold the dome.[2]:124 A portal was adjacent to the hall along with vestibule. On the southern wall of the hall there used to be a mihrab.[2]:102
Together with the mausoleum and the Keygubad Mosque, the middle courtyard occupies a neutral position in the Shirvanshahs' palace complex due to its location.[2]:103
1234Fətullayev-Fiqarov, Şamil (2013). Bakının memarlıq ensiklopediyası[Architectural Encyclopedia of Baku] (in Azerbaijani). Bakı: Şərq-Qərb, Azərbaycan Respubliksı Memarlar İttifaqı. p.528.
Bibliography
Dadaşov, S.; Useynov, M. (1955). Bakının memarlıq abidələri (in Azerbaijani). Bakı: Azərbaycan SSR Elmlər Akademiyası Nəşriyyatı. p.42.
Fərhadoğlu, Kamil (2006). İçərişəhər (in Azerbaijani). Bakı: Şərq-Qərb nəşriyyatı, AMEA Arxeologiya və Etnoqrafiya İnstitutu. p.256.