Jerusalem came under Islamic rule during the time of the Caliph Umar (r.a) in the year 638 AD. It was a peaceful conquest. The ruler and cardinal of Jerusalem called Sophronius himself handed the key of Jerusalem to Umar (r.a). While entering the city, the Caliph Umar asked where Baitul Maqdis and the holy stone stepped by the Messenger (p.b.u.h) before the Al-Mi'raj were.
It was an isolated area at that time. Roman soldiers had destroyed what had been called the Second Temple in 70 AD. Since then, neither non-Christian nor Christian rulers had ever tried to rebuild it.
According to history, it was a garbage and animal waste disposal for the people of Jerusalem. Once the Caliph Umar was sure that that was the site of Baitul Maqdis and the place of Al-Mi'raj, he cleaned it with his own hands before observing a prayer and prostrated on the ground.
In 691 AD, the New Dome and other mosques were built. It was the first sacred monument which was the most expensive and biggest built in the history of Islam.
Jerusalem is always in the thoughts of the Muslim community. The Messenger (p.b.u.h) said, "Don't you burden yourself with travelling (for the purpose of worship) except to three mosques; Masjid Al-Haram in Mecca, my Mosque in Medina and the Al-Aqsa Mosque in Jerusalem." Based on this hadith, the Muslim community considers that it is a good practice to visit the city of Jerusalem, its mosque, its sanctity and its blessed environment. Pilgrims often visit Jerusalem before going on pilgrimage in Mecca and Medina.
Islamic leaders have built many hospitals, schools and religious centers around the city. They bought land in and around Jerusalem to be the land of Endowments for religious purpose. In fact, the entire city of Jerusalem is the land of Endowments and cannot be sold or transferred ownership.
Many Islamic scholars moved and stayed there. The Al-Aqsa Mosque is an ideal place to study. Thousands of believers and scholars have it in their will that their bodies are to be buried in Jerusalem upon death. There are thousands or perhaps millions of Muslim graves in Jerusalem. Muslims also recognize the rights of Christians and Jews in Jerusalem who hold the city close to their hearts and deem it holy in their faith. During the reign of Islam, they are allowed to live there. At the time of Caliph Umar's rule, an agreement was made with Sophronius, where they agreed to the Christian priest's demand that "No Jews will be allowed to live with them in Aelia (Jerusalem)." However, at a later time during the reign of Islam, the law was slightly relaxed and the Jewish people were allowed to come and live there. After the second conquest of Jerusalem by Saladin, the Jews were again permitted by the Muslims to return and live in Jerusalem. Prior to that, Jerusalem was ruled by the Christians for about 90 years (1099-1187) and they had banned the Jews and Muslims from living in Jerusalem.