If a person is at a place where he does not know in which direction the qiblah is, nor is there anyone whom he could ask, then he should think in his heart. Whichever direction his heart tells him to face, he should turn in that direction. If he offers his salaat without thinking, his salaat will not be valid. However, if, in this case where he did not think, he later learns that the direction in which he had offered his salaat was the correct direction, then his salaat will be valid. If there was a person whom he could ask, but because of hijaab and shyness, he did not ask and continued with his salaat, it will not be valid. In such cases, one should not feel shy, but should ask and then offer the salaat. If there was no one who could show him the direction and he offered his salaat according to what his heart told him, and later he learnt that the direction in which he had offered his salaat was wrong; even then his salaat will be valid. If a person was offering his salaat in the wrong direction and in his very salaat he learns that this is the wrong direction and that the correct direction is the other way, he should turn towards the qiblah in his very salaat. If after learning the correct direction, he did not turn towards the qiblah, his salaat will not be valid. It is permissible for a person to offer salaat inside the Ka’bah. The person offering salaat inside the Ka’bah has the choice to face in whichever direction he wishes. Both fard and nafl salaats are permissible in the Ka’bah. If the qiblah is not known and salaat is being offered in congregation, then the imam and those following him – all of them will have to act according to their conviction. If the conviction of a particular muqtadi is contrary to that of the imam, his salaat will not be valid behind that imam. This is so because according to him that imam is in error, and it is not permissible to follow someone while considering him to be in error. Therefore, in this case, the muqtadi will have to offer his salaat on his own according to his own conviction.