The first Qibla before the Kaaba was the Bayt al-Maqdis (Al-Aqsa) in Jerusalem. Muslims prayed towards this direction for several years before the Qibla was changed to the Kaaba in Mecca. The change of Qibla took place about 16-17 months after Prophet Muhammads immigration to Madinah. This shift in the direction of salah was revealed to the Prophet through divine command, signifying the significance of the Kaaba as the new Qibla for Muslims.