Deviating From The Qiblah
Turning towards the direction of the qiblah [direction of prayer] is among the conditions for the validity of prayer;
Allah the Almighty says: So from wherever you go out [for prayer, O Muhammad] turn your face toward al- Masjid al-Haram, and indeed, it is the truth from your Lord. And Allah is not unaware of what you do. 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 favour upon you and that you may be guided. [Qur’an 2:150]
A Muslim must do his best to determine the direction of the qiblah. If he cannot determine it through any means, he is to use his own personal reasoning and then perform prayers. The Prophet [peace and blessings be upon him] said: “If I command you to do something, then perform it according to your abilities” [Ahmed].
The exact determination of the qiblah direction is when one sees the Ka’ba itself. When in its proximity, it is impermissible to deviate from it at all. However, if the Ka’ba itself is not visible to the person praying, as in the inquirer’s case when in his mosque, there is no harm in deviating slightly to either the right or left from the proper direction provided that he keeps some part of his face aligned with any part of the Ka’ba. Scholars determined this to be 90 degrees i.e. 45 degrees from each direction of the face by facing the direction of the Ka’ba.
Allah the Almighty says: So turn your face toward al-Masjid al-Haram. Qur`an 2:144
The Ruling
There is no objection to adjusting the rows by not more than 45 degrees from any of the qiblah directions established in the village.
(دار الإفتاء المصرية – eng.dar-alifta.org)