Answered by Ustadh Tabraze Azam
Question: As salam alaykum,
Is my obligatory prayer prayed alone valid despite the fact that a congregation praying the same prayer started right after me?
I pray that this message finds you well, insha’Allah.
Yes, your prayer would remain valid in the scenario you mention because you did not do anything invalidating.
However, in the case that you are praying alone and a congregation starts, it would be permitted to break your prayer and then join the congregation.
But there is detail on how to break the prayer:
(1) If you are in the first cycle (rak`at) of Zuhr, `Asr or `Isha’, and have not yet prostrated, you would say the salam and then exit the prayer.
(2) The same ruling as (1) applies if you actually prostrated for the first cycle in Fajr or Maghrib.
(3) If you prostrated for Zuhr, `Asr or `Isha’, you would add a second cycle, and then exit the prayer.
(4) If you prostrated for the second cycle in Fajr or Maghrib, you would simply complete the prayer.
[Shurunbulali, Maraqi al-Falah]
And consider taking the following free class at SeekersHub: Absolute Essentials of Islam: Basic Hanafi Jurisprudence (STEP)
And Allah alone knows best.
Checked & Approved by Shaykh Faraz Rabbani