(a) It is narrated from al-Miswar bin Makhramah (may Allah be pleased with him) that he should pray the prayer again afresh.
(b) Imam al-Shafi'i (may Allah have mercy on him) said: The best view in my opinion is that this breaks the prayer, and this is the view of al-Miswar bin Makhramah (may Allah be pleased with him). It is also very close to the view of the generality of scholars regarding one who deliberately turns his back to the qiblah, that he starts afresh.
(c) He said: It is not permissible for him to be in a state in which prayer is not valid and then continue on his prayer in that way.
(d) His old view was that he continues on the same prayer.
(e) He said in al-Imla': Were it not for the positions of the jurists, I would hold that whoever turns away from the qiblah, whether because of a nosebleed or for some other reason, must start the prayer afresh; but in the reports there is nothing but acceptance. He said: This concerns this issue and other issues. And in his new view he indeed went back to the view of al-Miswar (may Allah be pleased with him). Wa billahi al-tawfiq (And success comes only from Allah).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3395