Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:2:150

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 in order that the people will not have any argument against you, except for those of them who commit wrong; so fear them not but fear Me. And ˹it is˺ so I may complete My favor upon you and that you may be guided.  

From whatever place you issue, turn your face towards the Sacred Mosque; and wherever you may be, turn your faces towards it (all of which is being repeated for emphasis), so that there be not any argument from the people, the Jews or the idolaters, against you, ˹so that there be not˺ any cause for contention regarding the change to a different direction of prayer. In this way, their contentions against you will cease to exist, both ˹the contentions˺ of the Jews when they say, ‘He ˹Muhammad (s)˺ rejects our religion, but follows our direction of prayer’, and of the idolaters when they say, ‘He ˹Muhammad (s)˺ claims to follow the creed of Abraham, but he contravenes his ˹Abraham’s˺ qibla’; excepting the evildoers among them, acting in obstinacy, who will say, ‘He ˹Muhammad (s)˺ only changed to this direction because of his ˹natural˺ inclination towards the ˹idolatrous˺ religion of his forefathers’. The exceptive statement ˹indicated by illā˺ is a continuous one, the meaning being: ‘No one will have anything to say against you, except for what these people say’; and do not fear them, do not fear their arguing ˹with you˺ regarding the change to it ˹the Ka‘ba˺, but fear Me, by complying with My command; and that I may perfect My grace upon you, by guiding you to the principal rituals of your religion, and that you may be guided, to the truth (wa-li-utimma, ‘that I may perfect’, is a supplement to li-allā yakūna, ‘that there be not’).
القرآن:٢:١٥٠

وَمِنْ حَيْثُ خَرَجْتَ فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ ۚ وَحَيْثُ مَا كُنْتُمْ فَوَلُّوا وُجُوهَكُمْ شَطْرَهُ لِئَلَّا يَكُونَ لِلنَّاسِ عَلَيْكُمْ حُجَّةٌ إِلَّا الَّذِينَ ظَلَمُوا مِنْهُمْ فَلَا تَخْشَوْهُمْ وَاخْشَوْنِي وَلِأُتِمَّ نِعْمَتِي عَلَيْكُمْ وَلَعَلَّكُمْ تَهْتَدُونَ  

{ومن حيث خرجت فولِّ وجهك شطر المسجد الحرام وحيثما كنتم فولوا وجوهكم شطره} كرره للتأكيد {لئلا يكون للناس} اليهود أو المشركين {عليكم حجة} أي مجادلة في التولي إلى غيره أي لتنتفي مجادلتهم لكم من قول اليهود يجحد ديننا ويتبع قبلتنا وقول المشركين يدعي ملة إبراهيم ويخالف قبلته {إلا الذين ظلموا منهم} بالعناد فإنهم يقولون ما تحول إليها إلا ميلا إلى دين آبائه والاستثناء متصل والمعنى: لا يكون لأحد عليكم كلام إلا كلام هؤلاء {فلا تخشوهم} تخافوا جدالهم في التولي إليها {واخشوني} بامتثال أمري {ولأتم} عطف علي لئلا يكون {نعمتي عليكم} بالهداية إلى معالم دينكم {ولعلكم تهتدون} إلى الحق.