Could you please explain how to treat one’s prayer if one joins a congregational prayer that has already finished one or more Rak’ah.
If you join a congregation in a prayer consisting of 4 Rak’ahs when the congregation are in the third Rak’ah, you may either treat your first Rak’ah as the first or the third Rak’ah. If you opt for the latter, you are counting your Rak’ahs according to what the imam has completed. Therefore, when the imam finishes, you have to make up your first and second Rak’ahs. On the other hand, if you treat the two Rak’ahs you pray with the congregation as your first and second, you need to complete your prayer after the imam has finished by praying the third and fourth Rak’ahs.
Different scholars approve both ways. [the second option works only if you know what Rak’ah you are joining in.]