Prior to its construction, the archeological site it stands on contained an ancient building said to date back to the Neo-Babylonian Empire. An archeological restoration dating back to the summer of 1975 found the remains of a wall with bitumen. Inscriptions on the mudbricks contained the seal of prominent Babylonian king Nebuchadnezzar II (605–562 BC). This seal indicates that a structure to stop floods from rising to a sort of royal palace or a temple dedicated to the god Marduk was located in this area prior to the construction of the city.[2]
The modern complex was originally established by Dawud Pasha, the last of the Iraqi Mamluks during the Ottoman Empire era. In the area, he ordered shops, and an endowment to be built. So was the case for the mosque, which is located in the Ra's al-Jisr neighborhood. It was then given to a scholar named Muhammad Sa'id al-Suwaidi to study in it. The pasha built it on the condition that it be an old mosque, and he stipulated in his endowment some allowances for the teacher, the imam, the perfumer, the servant, and the muezzin. Today, the complex has a large courtyard, and a wooden-roofed prayer hall.[3]
The firm belief that the building contains the alleged tomb of al-Khidr also dates back to Sufis living in Baghdad at the time. The area around the shrine contained many Sufi lodges and religious families that gathered around the banks of the Tigris river. Among these Sufi lodges was one located opposite the shrine that used to belong to the Iraqi al-Izzat family tribe that came from al-Khalis. Next to the shrine is an old Baghdadi neighborhood named after it also called Khidr Elias, in which families since the Ottoman era gathered around it to light candles across the Tigris river. This was in due to the firm belief that al-Khidr's tomb was located in the complex.
Since the 1980s, the shrine's location has become a local tourist spot, and a social place for family gatherings. Its location around old neighborhoods and next to the Tigris river gave it a strong significance. Children are also brought to play around the courtyard. Gatherings mostly occur on holidays, such as Ramadan and Eid Khidr Elias.[6][7]