[Machine] From the scholars of the people of Madinah, it is reported that they used to say: "Whoever prays without being in a state of purity or without facing the qiblah should repeat the prayer, whether it was performed within its proper time or outside of it, unless their mistake was a slight deviation from the qiblah or a minor mistake." And it has been narrated from Ibrahim al-Nakha'i that he said: "Whoever prays towards a direction other than the qiblah does not need to repeat the prayer."
عَنِ الْفُقَهَاءِ مِنْ أَهْلِ الْمَدِينَةِ أَنَّهُمْ كَانُوا يَقُولُونَ مَنْ صَلَّى عَلَى غَيْرِ طُهْرٍ أَوْ عَلَى غَيْرِ قِبْلَةٍ أَعَادَ الصَّلَاةَ كَانَ فِي الْوَقْتِ أَوْ غَيْرِ الْوَقْتِ إِلَّا أَنْ يَكُونَ خَطَاؤُهُ الْقِبْلَةَ تَحَرُّفًا أَوْ شَيْئًا يَسِيرًا وَرُوِّينَا عَنْ إِبْرَاهِيمَ النَّخَعِيِّ أَنَّهُ قَالَ فِي الَّذِي يُصَلِّي لِغَيْرِ الْقِبْلَةِ لَا يُعِيدُ