He then pointed out that the reason for this exception was the spaciousness of the Mosque and the cramped outskirts of Mecca. He said:
“If a town were to develop in such a way that its mosque could hold all of its people on the days of ʿEid, I would see no need for them to leave it. But if the mosque could not accommodate them, I would regard praying inside it as disliked, though the prayer would not have to be repeated.1”
The upshot of this statement is that the determining factor is the mosque’s capacity, not the act of going out to the desert itself. The goal is to assemble the entire community; if that can be achieved in the mosque—whose intrinsic merit is greater—then praying there takes precedence.
Imām al-Shawkānī critiqued this, saying (3/248):
“To claim that the only reason is the mosque’s capacity is mere conjecture; such speculation is insufficient to excuse abandoning the Prophet’s ﷺ practice of going to the jabbānah2, after having conceded that he regularly did so.”
As for adducing the performance of the prayer as evidence that this is the underlying cause