In the 15th century the Shirvanshah dynasty, under Ibrahim I of Shirvan, transferred his capital from Shemakha to Baku following a devastating earthquake. He committed himself to the construction of the "palace".[clarification needed] The building is believed to be a memorial complex built around the sacred place of worship (pir) and tomb of Seyyid Yaxya Bakuvi who was a Helwati Sufi saint. The Shirvanshahs were patrons of the Helwati Sufiye order, and Shirvanshah Khalilullah I was buried with his family in the grounds of the palace. Other historians argue that the building was used as the ruler's palace. Both theories suffer from the absence of evidence. It is known that wells inside the grounds of the "palace" were considered to have healing qualities until recent times, as was the hill where the palace was built.
After the Safavid conquest of Baku in 1501, the Sufi order was expelled. Over centuries the "palace" fell into ruin and was known in Baku as Baku Khans palace; this toponym moved into Russian historiography, first cited by Bartold.
Until 1501, there was not any information found about the building of the palace. According to one of the Persian chronicles, in 1501 the troops of Shirvanshakh Farrukh-yessar, the son Khalil-ully I, were defeated in Shemakha by the troops of Shah Ismail I from the Safavid dynasty. Farrukh-yessar was killed in the Battle of Shirvanshah; the troops of Ismail I, having defeated near Shemakha, moved to Baku, besieged it and after several assaults took the city.[7] Then, a tall building of Shirvanshahs was destroyed due to the order of Shah Ismail I. After a while, the city of Baku and its entire district, as well as Shirvan, were governed by the governors who were placed by the Safavids. There is not any detailed information about the people who lived in the palace and in what state it was in the first half of the 16th century.
In the second half of the 16th century, there was a war between the Safavids and the Ottoman Empire. In 1578, the Turks conquered Baku. From the time of the rule of the Ottoman Empire in the palace area, the gate in the palace wall surrounding the palace from the east has been preserved. From the inscription placed on the portal of this gate, it follows that they were built during the reign of the Turkish sultan Murad III (1574–1595 years of rule).
Due to the literary works, there were Turkish pashas living in the palace at that time. The East Gate is a witness of this.
Since the 17th century, the palace was empty, and there were not any government officials. The abbot of the monastery and the representative of the Isfahan mission Capuchin Pater Raphael du Mans in his essay in 1660 described Shirvanshah Palace in Baku fortress and gave information about its desolation and destruction. In 1723, Baku was besieged by the troops of Peter I, and the city was bombed. In this regard, the south-eastern facades of the palace suffered much. The palace was transferred to the Russian military department in the middle of the 19th century.
The Russian military department made a partial renovation of the palace. At the same time, the significant restructuring was carried out, which adapted the palace facilities to warehouses for military equipment. Repairs carried out by the military department, along with the restoration of the destroyed parts, and led to the destruction of a number of parts required for the restoration of the palace. By adapting the building of the palace to the warehouse, the military department demolished a number of walls separating the rooms in the second and first floors, and there were semi-circular arches supporting the roof instead of them on the second floor.
The remains of domed, lancet and cross-slabs were destroyed in all the rooms on the second floor; they were replaced by flat beams. A…