Al-Hakim related that `Ali bin Abu Talib said:
﴿ فَوَلِّ وَجۡهَكَ شَطۡرَ ٱلۡمَسۡجِدِ ٱلۡحَرَامِۚ ﴾
(...so turn your face in the direction of Al-Masjid Al-Haram (at Makkah).) means its direction.''
Al-Hakim then commented that the chain of this narration is authentic and that they (i.e., Al-Bukhari and Muslim) did not include it in their collections.
This ruling concerning the Qiblah is also the opinion of Abu Al-`Aliyah, Mujahid, `Ikrimah, Sa`id bin Jubayr, Qatadah, Ar-Rabi` bin Anas and others. Allah's Statement:
﴿ وَحَيۡثُ مَا كُنتُمۡ فَوَلُّواْ وُجُوهَكُمۡ شَطۡرَهُ ۥۗ ﴾
(And wheresoever you people are, turn your faces (in prayer) in that direction) is a command from Allah to face the Ka`bah from wherever one is on the earth: the east, west, north or south. The exception is of the voluntary prayer (Nafl) while one is traveling, for one is allowed to offer it in any direction his body is facing, while his heart is intending the Ka`bah. Also, when the battle is raging, one is allowed to offer prayer, however he is able. Also, included are those who are not sure of the direction and offer prayer in the wrong direction, thinking that it is the direction of the Qiblah, because Allah does not burden a soul beyond what it can bear.