[Machine] The first thing that was abrogated from the Quran regarding the mention of the matter of the Qibla, Allah said, "{To Allah belongs the east and the west. So wherever you [might] turn, there is the face of Allah.}" (Al-Baqarah 2:115). So the Messenger of Allah ﷺ turned towards the direction of Bait al-Maqdis (Jerusalem) and left the Ancient House (Kaaba), and then Allah, the Exalted, said, "{The foolish among the people will say, 'What has turned them away from their qiblah, which they used to face?'}" (Al-Baqarah 2:142). They meant Bait al-Maqdis, so Allah abrogated it and directed it to the Ancient House, and Allah, the Exalted, said, "{And from wherever you go out [for prayer], turn your face toward al-Masjid al-Haram. And wherever you [believers] may be, turn your faces toward it}" (Al-Baqarah 2:150).
أَوَّلُ مَا نُسِخَ مِنَ الْقُرْآنِ فِيمَا ذُكِرَ لَنَا شَأْنُ الْقِبْلَةِ قَالَ اللَّهُ {وَلِلَّهِ الْمَشْرِقُ وَالْمَغْرِبُ فَأَيْنَمَا تُوَلُّوا فَثَمَّ وَجْهُ اللَّهِ} [البقرة 115] فَاسْتَقْبَلَ رَسُولُ اللَّهِ ﷺ فَصَلَّى نَحْوَ بَيْتِ الْمَقْدِسِ وَتَرَكَ الْبَيْتَ الْعَتِيقَ فَقَالَ اللَّهُ تَعَالَى {سَيَقُولُ السُّفَهَاءُ مِنَ النَّاسِ مَا وَلَّاهُمْ عَنْ قِبْلَتِهِمُ الَّتِي كَانُوا عَلَيْهَا} [البقرة 142] يَعْنُونَ بَيْتَ الْمَقْدِسِ فَنَسَخَتْهَا وَصَرَفَهُ اللَّهُ إِلَى الْبَيْتِ الْعَتِيقِ فَقَالَ اللَّهُ تَعَالَى {وَمِنْ حَيْثُ خَرَجْتَ فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ وَحَيْثُ مَا كُنْتُمْ فَوَلُّوا وُجُوهَكُمْ شَطْرَهُ} [البقرة 150]