The Mistake in the Intention of Prayer

Question
What is the ruling for someone who was preoccupied and missed the Dhuhr prayer on time without realizing it, and when the call to prayer for Asr was made, he attended the prayer in the mosque thinking he was praying Dhuhr, having intended to perform Dhuhr? When the sun set, he realized the mistake he made and prayed Maghrib, then he stood up to make up the Dhuhr prayer even though he had already prayed it during Asr behind the imam. What should he do? Is the prayer he performed behind the imam during Asr counted as Dhuhr? Does he need to repeat Dhuhr, Asr, or both?
Answer
I say, and with God's help: The Asr prayer is valid even if he made a mistake in his intention; because the time is the time of Asr, and he intended the obligatory prayer of the time, which is Asr, so it is valid. He must make up the Dhuhr 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