Bab al-Barqiyya was originally an eastern gate in the walls of Cairo that were built by the Fatimids during their foundation of the city in the 10th century. This gate, along with the other gates of that time, subsequently disappeared.[3]: 37 The gate was rebuilt by Badr al-Gamali, the vizier under the Fatimid caliph al-Mustansir, as part of his reconstruction of the walls of Cairo in the 11th century.[4]: 99 The present-day gates of Bab al-Futuh, Bab al-Nasr, and Bab Zuweila also date from this time.[4]: 189, 243–246
Archeological excavations have also unearthed another gate from this time, named Bab al-Tawfiq ("Gate of Success") according to an inscription panel found on it.[2][1] It is possible that the name Bab al-Barqiyya actually corresponded to this gate, which would have thus replaced the earlier Fatimid gate of the same name.[1][4]: 99
Under the Ayyubid sultan Salah ad-Din (Saladin), the Fatimid walls and gates were restored in 1171.[5]: 288 In 1176, Salah ad-Din then began a project to radically expand the city's fortifications. This project included the construction of the Citadel of Cairo and a 20 kilometer-long wall to connect and protect both Cairo (referring to the former royal city of the Fatimid caliphs) and Fustat (the main city and earlier capital of Egypt a short distance to the southwest). The entirety of the envisioned course of the wall was never quite completed, but long stretches of the wall were built, including the section to the north of the Citadel and a section near Fustat in the south.[3]: 90–91 Following this work, three eastern gates of the city are recorded by historical sources such as al-Maqrizi: Bab al-Barqiyya, Bab al-Mahruq ("Burned Gate") and Bab al-Jadid ("New Gate").[3]: 91 [1]
Bab al-Barqiyya was thus one of the main eastern gates of the city. Outside it was a desert area which was initially used by the Mamluks for equestrian games, a tradition started by Baybars and ended in 1320 by al-Nasir Muhammad.[6]: 175 Later on, during the Burji Mamluk period, this area was the site of new Mamluk mausoleum complexes, now known as the Northern Cemetery. In the meantime, however, the city's growth and the relative security of the region made Bab al-Barqiyya's function as defensive gate less and less important. The gate, and the city walls around it, fell into disuse and the inhabitants of the city built new houses and structures into them or on top of them. Over time, the eastern edge of the city, where the walls once stood, became a dumping ground for the city's detritus. The walls and gates disappeared under a growing mound of debris, though they remained largely intact.[7]
In the late 1990s and early 2000s, the rubbish hills east of the historic city were excavated and transformed by the Aga Khan Trust for Culture into al-Azhar Park, which opened in 2005.[8][4]: 99 The gate and parts of the Ayyubid wall were first uncovered during this work in 1998. A joint French-Egyptian archeological investigation took place after this, starting in 2000 and lasting four years.[5] The gate, first uncovered in 1998, has been identified as Bab al-Barqiyya; but this identification has been debated. It is possible that it actually corresponds to the gate identified by al-Maqrizi as Bab al-Jadid.[1] The gate, now restored, stands on the western edge of Al-Azhar Park.[9] Another nearby Ayyubid gate located further south, Bab al-Mahruq, was also transformed into the western entrance to the park from the Darb al-Ahmar neighbourhood.[10]