His name was Muhammad ibn Hani and his Kunya was either Abul-Qasim or Abul-Hasan. He belonged to the tribes of Azd. His father was a resident of a village near Mahdiya in North Africa. He lost all his belongings because of his love for poetry and had to migrate to Spain. There his son Muhammad was born in the town of lshbiliya in 320 H. Muhammad was attached to the court of the local ruler for whom he wrote poems. However, the population got restive due to his association with the extremist Batini philosophy. He was thus forced to migrate in 347 H. at the age of 27. He contacted Jawhar but then wandered along to the courts of other rulers. At last he was attracted by the generous patronage of Imam Mu'izz whose retinue he joined. Since then he remained throughout with the Imam in Mansuriya and accompanied him on his journey to Egypt. On the way at 'Barqa he was found dead at the sea-side. He was killed by some enemy who could not be traced. Imam Mu'izz was extremely sad at this unfortunate happening and remarked that Ibn Hani was one of the greatest poets of the East in whose service he took pride.
Ibn Hani left behind a Diwan which is edited by Dr. Zahid Ali. It contains about 246 pages. Most of the poems are in praise of Imam Mu'izz and the Fatimid Dynasty. There is no proof that Ibn Hani was converted to Ismailism, but it is quite likely that he was, judging by the extreme love for the Imam and his followers shown by the poet in his writings.