The First Appearance and Development of the Idea of the Mahdi
The word "Mahdi" is originally a simple word, an active participle from the verb "hada" (to guide). Thus, anyone guided by God is a "mahdi." This meaning was used during the time of the Prophet, peace be upon him. The hadith states: "Adhere to my Sunnah and the Sunnah of the rightly guided caliphs." This usage only reflects the linguistic meaning of the word. The word also appears in the poetry of Hassan bin Thabit, the Prophet's poet, when he mourned the Prophet, peace be upon him:
What is wrong with your eyes that they do not sleep, as if their sockets were lined with kohl of the red-eyed? Grieving for the guided one who has now rested, O best of those who have trod upon pebbles, do not depart. My father and mother be sacrificed for him whose death I witnessed on a Monday, the guided Prophet.
...
Al-Farazdaq praised Sulayman ibn Abd al-Malik, saying: Sulayman the blessed, you know, is the guided one, the path has become clear.