Maghrib (Arabic: صلاة المغرب) is one of the five mandatory salah (Islamic prayers), and contains three cycles (rak'a). If counted from midnight, it is the fourth one.
According to Shia and Sunni Muslims, the period for Maghrib prayer starts just after sunset, following Asr prayer, and ends at the beginning of night, the start of the Isha prayer. As for Shia Muslims, since they allow Maghrib and Isha prayers to be performed one after another, the period for Maghrib prayer extends until midnight. Sunni Muslims (Except for the Hanafi school) are also permitted to combine Maghrib and Isha prayers if they are traveling and incapable of performing the prayers separately. In this case, the period for Maghrib prayer extends from sunset to dawn, as with Shiites.