Ha-Mim is the short form of the name Ha-Mim ibn Mann-Allah ibn Harir ibn Umar ibn Rahfu ibn Azerwal ibn Majkasa, also known as Abu Muhammad; he was a member of the Majkasa sub-tribe of the Ghomara Berbers who proclaimed himself a prophet in 925 near Tetouan in Morocco. He was named after a well-known combination of Qur'anic initial letters.
His claim was widely accepted among the Ghomara of the time, and he established rules for them. He said that he received a revelation in the Berber language, portions of which historian Ibn Khaldun quotes in Arabic: "O You who are beyond sight, who watches the world, release me from my sins! O You who saved Moses from the sea, You believe in Ha-Mim and in his father Abu-Khalaf Mann Allah..."
He died in 927 fighting the Masmuda Berbers near Tangier, and was succeeded politically by his son Isa, who sent an embassy to the Umayyad Caliph Abd-ar-rahman III an-Nasir. His religion's later history is unclear, but it vanished well before even Ibn Khaldun's time.