History of al-Haramayn al-Sharifayn
‘It is the first temple ever to be built for men, a blessed place a beacon for the nations' (3:96) and the most ancient of them in the Middle East. It was first built by Ibrahim, the ancestor of the prophets, and Isma'il, his son, and the Qur'an quotes them praying as they raised its walls:
وَإِذْ يَرْفَعُ إِبْرَاهِيمُ الْقَوَاعِدَ مِنَ الْبَيْتِ وَإِسْمَاعِيلُ رَبَّنَا تَقَبَّلْ مِنَّا إِنَّكَ أَنْتَ السَّمِيعُ الْعَلِيمُ
Isma'il gathered the stones and Ibrahim put them on one another until the walls were raised to the height of a man. Then the Black Stone was put in its place. According to tradition, the Ka'bah (alBayt alAtiq) was nine cubits high and had an area of twenty by thirty cubits when Ibrahim (‘a) built it. It had two doors, but was without a roof.
As to the Black Stone, it is said to have been brought by Gabriel from heaven. It is also said that Adam brought it along with him on his descent from Paradise, that at first it was snowwhite and was blackened by the deeds of men, and so on. There is no harm in not believing any of these stories and the like, nor are we obliged to establish their verity, nor to know the origin of the Stone. All we are obliged to do is to revere it because the Prophet (s) considered it sacred and revered it. If someone asks the secret behind the Prophet's regarding this stone as sacred, all we can say is that only God and His Apostle know best.
According to some traditions the Ka'bah stood as Ibrahim and Isma’il had built it until it was rebuilt by Qusayy ibn Kilab, the fifth ancestor of the Prophet (s). The structure built by Qusayy stood until the time when the Prophet was 35 years old, when a great flood demolished its walls. The Quraysh rebuilt it. When the walls were raised to a man's height the clans disputed as to who should receive the honour of lifting the Black Stone into its place. They almost came to war with one another, if it was not for their making Muhammad the arbiter amongst themselves.
The Prophet's solution was to spread a cloak on the ground. Then taking up the Black Stone he laid it on the middle of the garment. "Let the eldest of each clan take hold of the border of the cloak," he said. "Then lift it up, all of you together." When they had raised it to the right height, he took the Stone and placed it in the corner with his own hands.
May God's benedictions and His mercy be upon you, O Apostle of God! You raised the Stone first with your noble hands from the ground and then put it into its place again with your hands. Thus you made God and man well pleased with you. This event was a definite evidence of your superiority over all, and of your being a ‘mercy for all the worlds', before your declaration of the apostlehood as after it. Your act was a clear sign that you were the bearer of a Divine mission, and that those who rejected you were enemies and opponents of the truth and of humanity.
The Ka'bah remained in its condition until Yazid ibn Mu'awiyah became caliph and till ‘Abd Allah ibn alZubayr challenged his sovereignty over the Hijaz. Yazid's forces installed catapults on the hills around Makkah and bombarded the Ka'bah with tens of thousands of stones. The Ka'bah caught fire which finally demolished its structure. Ibn alZubayr repaired it as it was before without making any changes, and he put a wooden fence around it. When ‘Abd alMalik ibn Marwan came to power, Ibn alZubayr was besieged by his forces under alHajjaj ibn Yusuf, who ultimately killed Ibn alZubayr after causing damage to a part of the Ka'bah. AlHajjaj rebuilt the demolished portions and made some changes in the walls as they used to be, and also had one of its doors (the ‘western door') blocked.
The Ka'bah remained in the altered condition after alHajjaj's repairs until the year 1040/1630 when its walls collapsed due to heavy rains. Thereafter the Muslims from every corner gathered together to restore it and collected contributions from various regions of the Muslim world to rebuild it in the form as it stands to this day.
When the Prophet came to alMadinah after the migration, the first thing that he built there was the mosque. Afterwards he built the houses by its side. At first its area was 30 by 35 metres, which the Prophet (S) extended, making it 57 by 50 metres.
There was no minbar in the mosque at the time of its making. The Prophet (s) used to deliver his sermons leaning against one of the pillars, which were made of trunks of datepalms. Later, the Companions built a wooden minbar with two steps. ‘Umar ibn alKhattab, during his reign, extended the mosque by five metres on southern and western sides and fifteen on the northern. He left untouched the eastern side where the dwellings of the Prophet's wives were situated.
‘Uthman ibn ‘Affan demolished the mosque and rebuilt it, extending it in area by an amount almost equal to the one before by ‘Umar and left the houses of the Prophet's wives untouched. The building remained as ‘Uthman had made it until alWalid ibn ‘Abd alMalik demolished it again and extended it on all sides, and including even the houses of the Prophet's wives, together with that of ‘A'ishah, thus making the Prophet's tomb a part of the mosque.
The building constructed by alWalid stood until 266/879 when alMahdi, the ‘Abbasid caliph, greatly extended its northern side. The building endured until the year 654/1256 when a fire broke out bringing down the roof and burning doors and the Prophet's minbar. The Mamluk sultan alZahir rukn alDin Baybars I (658676/12601277) ordered its reconstruction and the mosque was restored to its original form before the fire.
In 886/1481, lightning struck the mosque destroying all the building except the chamber of the Prophet's tomb and a dome in the mosque's courtyard. It was rebuilt by the Mamluk king al'Ashraf Sayf alDin Qait Bay (872901/146795) in a fashion better than before. In the 10th/16th century the Ottoman sultan Salim had it renovated, building the mihrab (niche) on the western side of the minbar and which is still there.
In the 13th/19th century the Ottoman sultan Mahmud II (12231255/18081839) had the green dome constructed. During the same century the mosque again needed repairs, which were carried out by the orders of the Ottoman sultan. This time, the engineers dismantled the old building little by little gradually building in its place the new structure which was completed in 1277/1861.
و صل اللهم على محمد و اهله الطاهرين و عرف بيننا و بينهم, و ارزقنا شفاعتهم يوم نلقاك,
يا مبدل السيئات بأضعافها من الحسنات... انك ذو الفضل العظيم