Please note: this fatwa has been translated by artificial intelligence.
Question
What is the ruling for someone who intended to pray Fajr, then heard the Iqama from the nearby mosque and changed their intention to a voluntary prayer, then joined the congregational prayer with the intention of earning the reward of the congregation?
Answer
I say, and with God's success: It is permissible to change the intention for another prayer, as you have done, and then go to the mosque to catch the congregation, and God knows best.