Dr. Marawan Shahin, Professor of Hadith and its Sciences, Faculty of Usul Ad-Din (Theology),Al-Azhar Univ. states: “One can intend maghrib behind the imam and when the imam wants to stand for the fourth rak`ah, the maghrib intender can intend to separate from jama`ah (the congregation) by sitting for tashahhus and saying taslim.
Another way is to intend `Isha’ with the congregation and then offer maghrib prayer. This is in accordance with the opinion of Muslim scholars who do not stipulate the arrangement as a condition.
For further elaboration on regulations concerning Masbuq (the follower who joins the congregation after its beginning), we’d like to cite the following:
“The Masbuq after joining the congregation has to perform the remaining prayer with the Imam. After the Imam has pronounced salutation and brought the prayer to an end, the Masbuq should stand up and complete his missed rak’ahs independently, in the following way:
1. First of all he should complete those rak’ah(s) that he missed.
2. He should sit in Qadah keeping in mind the rak’ah or rak’ahs that he has performed with the Imam, i.e. a person who joins the congregation during the Zuhr prayer for example, after three rak’ahs have been performed, should stand up after observing one (the fourth) rak’ah behind the Imam and then complete the remaining three rak’ahs independently as follows:
(a) He should start with al Fatiha, recite an additional passage and sit in the first Qadah after Sajdah to complete two rak’ahs (the first being the one he has observed with the Imam).
(b) he should stand up after reciting Tashahhud in the usual manner and begin his third rak’ah with al Fatiha which is to be followed by an additional passage, but should not sit in the Qadah.
(c) In the last rak’ah he should only recite al Fatiha and sit in the final Qadah and complete his prayer in the usual way.”