The Mahdi is a messianic figure in Islamic eschatology believed to appear at the end of times to rid the world of evil and injustice. He is often considered a descendant of the Prophet Muhammad and is associated with both Shia and Sunni beliefs, though their interpretations differ significantly.