First: ʿĀʾishah reported, “I used to sleep stretched out in front of the Messenger of Allah ﷺ with my feet toward his place of prostration; whenever he went down to prostrate, he would tap me …” In that same narration she says, “At that time the houses contained no lamps.” Agreed upon.
Second: Abū Barzah al-Aslamī (may Allah be pleased with him) reported that the Prophet ﷺ would finish the dawn prayer when a man could already recognize the person sitting next to him. This too is agreed upon.
This clearly indicates that there were no lamps in the mosques by which people could distinguish one another’s faces; hence he ﷺ concluded the Fajr prayer once the darkness had lifted and the first light had begun to spread, revealing their features. Allah knows best.
(See al-Tarātīb al-Idāriyya, chapter: “Were candles lit in Madinah during his ﷺ lifetime?” vol. 1, p. 85.)
Nevertheless, this does not invalidate the legitimacy of lighting the mosque, for in the previously cited ḥadith he ﷺ expressed a desire for it and that became the standard practice thereafter. We have merely added the proviso “provided there is no extravagance,” because extravagance is of no benefit and amounts to wasting wealth needlessly—something we have been forbidden to do. Thus the custom that people have adopted of greatly increasing the fuel of numerous lanterns—or nowadays, an abundance of electric lights—in many mosques on certain occasions and festivals