All perfect praise be to Allah, The Lord of The Worlds, and may His peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
The time for Maghrib prayer starts when the sun sets and continues until the twilight or red afterglow has faded{Old opinion}. It was also said it is equal to the time needed to get ready to offer prayer: making Taharah(Purity), covering Awrah, Athan, Iqamah and the performance of the five Rak`has(Fard and Sunnah). As such, it is a limited time and a person incurs sin if he fails to perform this prayer during it, and this is why Maghrib time was described as {Ghareeb}. In fact, this is the new opinion of Al-Shafie, but the reliable opinion in the Shafie school of thought {Madhab} is the old one.
"The time for Maghrib prayer, according to the texts of Sharia, starts when the sun sets. It was called Maghrib prayer because it is performed after sunset………..and its time continues until the twilight or red afterglow fades. This is the old opinion of Al-Shafie, and it is based on the following Hadith :Abdullah b. 'Amr reported: The Messenger of Allah (PBUH) said: The time of the noon prayer is when the sun passes the meridian and a man's shadow is the same (length) as his height, (and it lasts) as long as the time for the afternoon prayer has not come; the time for the afternoon prayer is as long as the sun has not become pale; the time of the evening prayer is as long as the twilight has not ended; the time of the night prayer is up to the middle of the average night and the time of the morning prayer is from the appearance of dawn, as long as the sun has not risen; but when the sun rises, refrain from prayer for it rises between the horns of the devil."{Related by Muslim}……….According to the new opinion, its time ends upon the end of the time needed for making Taharah(Purity), covering Awrah, Athan, Iqamah and the performance of the five Rak`has(Fard and Sunnah). This is because Gibrail{PBUH} performed Maghrib prayer at the same time over the two days he went to the Prophet Mohammad(PBUH); contrary to other prayers for he performed them at two different times within their prescribed time{Beginning and end}……………………………..
In conclusion, it is permissible to perform Maghrib prayer just before the start of the Isha` time, but to be on the safe side as far as the teachings of Sharia are concerned, one had better offer Maghrib prayer immediately after its time starts so as to avoid the disagreement of the scholars in this regard.And Allah knows best.