عَنْ أَنَسِ بْنِ مَالِكٍ رَضِيَ اللَّهُ عَنْهُ قَالَ: كَانَ إِذَا قَامَ الْمُؤَذِّنُ فَأَذَّنَ صَلَاةَ الْمَغْرِبِ فِي مَسْجِدِ الْمَدِينَةِ قَامَ مَنْ شَاءَ فَصَلَّى حَتَّى تُقَامَ الصَّلَاةُ وَمَنْ شَاءَ رَكَعَ رَكْعَتَيْنِ ثُمَّ قَعَدَ، وَذَلِكَ بَعْيْنَيِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ
Sayyiduna Anas bin Malik (may Allah be pleased with him) says that when the muezzin would stand up and give the adhan for Maghrib in the mosque of Madinah Munawwarah, whoever wished would stand and keep performing prayer until the congregational prayer was established, and whoever wished would perform two rak‘ahs and then sit down, and all of this would happen before the eyes of the Noble Prophet (peace and blessings be upon him).