Yahya ibn Abi Mansur and ʿAbd al-Rahman ibn Muhammad wrote to inform us, saying:
Umar ibn Muhammad al-Muʿallim informed us; Hibah Allah ibn Muhammad informed us; Muhammad ibn Muhammad ibn Ghaylan informed us; Abu Bakr al-Shafiʿi narrated to us; Ahmad ibn ʿUbayd Allah narrated to us; Yazid ibn Harun informed us; Muhammad ibn ʿAmr, from Abu Salamah, from Abu Hurayrah, reported that the Prophet ﷺ said:
“Mounts are not to be saddled for a journey except to three mosques: my mosque, the Sacred Mosque, and al-Aqsa Mosque.” (1)
Its meaning is that one should not set out for any mosque, seeking reward, other than these three, for they enjoy a special distinction.
Accordingly, whoever maintains that travelling to visit the grave of a prophet or a saint is not covered by the prohibition has adhered to the outward sense of the text, understanding the command and the ban as confined to mosques.
Whoever reasons by a fortiori analogy argues that, since the most excellent places on earth are its mosques and the prohibition is stated about them, then sites inferior in merit—such as the graves of prophets and the righteous—are even more deserving of the prohibition.
As for one who goes on foot, without saddling a mount, to visit the grave of a venerable person, this is, by unanimous agreement, an act of devotion without any misgiving—save for the solitary opinion of al-Shaʿbi and the like, who had heard only the initial prohibition of visiting graves and were unaware that it had been repealed. Allah knows best.