I Forgot and Prayed Maghrib as Four

Question
I intended to pray Maghrib, and during the prayer, I forgot and thought I was praying Isha, so I prayed four units, then I prayed the Sunnah, and after the Sunnah, I prayed two units before Witr. In the second unit, I remembered that it was the Maghrib prayer, so I completed the second unit and gave the salam, and then I prayed the prostration of forgetfulness. Is this acceptable, or should I repeat my prayer?
Answer
I say, and with God's success: You should perform the Maghrib prayer as three rak'ahs, as the four is considered a voluntary prayer, and God knows best.
imam icon

Send your question to the smart assistant

If the previous answers are not appropriate, please send your question to the Mufti via