Breaking off a prayer and leaving it
Question
What is the manner of exiting a congregational prayer before the imam finishes it?
Answer
Breaking off participation in a congregational prayer If a person wants to leave a congregational prayer to complete it alone, then he is not to make the intention for leaving it completely but only for breaking it off behind the imam.
This means he will not follow the imam but will complete the prayer on his own. His prayer in this case is valid although he misses the reward of a congregational prayer.
Exiting prayer completely
If a person performing a congregational prayer wants to leave the prayer completely, he is to resolve in his heart to exit it which is what a person performing an individual prayer or an imam leading prayer would do [in the same situation]. He does not need to make salam [salutation] or do anything further.
Exiting an obligatory prayer
It is prohibited for a person to leave an obligatory prayer without an excuse (whether he is praying alone, is an imam or following an imam).
Exiting a voluntary prayer It is disliked to leave a voluntary prayer without an excuse because Allah the Almighty says,Do not invalidate your deeds. [Muhammad: 33] There is no objection to leaving either a voluntary or obligatory prayer for an excuse because of the Islamic axiom which states, "Necessities allow prohibited matters".
Allah the Almighty knows best.