Ibn Ḥazm (; November 994 – 15 August 1064) was an Andalusi Muslim polymath, historian, traditionist, jurist, philosopher, and theologian, born in the Córdoban Caliphate, present-day Spain. Described as one of the strictest hadith interpreters, Ibn Hazm was a leading proponent and codifier of the Zahiri school of Islamic jurisprudence, and produced a reported 400 works, of which 40 still survive.Joseph A. Kechichian, A mind of his own. Gulf News: 21:30 20 December 2012.

In all, his written works amounted to some 80,000 pages.Ibrahim Kalin, Salim Ayduz (ed.), The Oxford Encyclopedia of Philosophy, Science, and Technology in Islam, Volume 1, p. 328 Also described as one of the fathers of comparative religion, the Encyclopaedia of Islam refers to him as having been one of the leading thinkers of the Muslim world.Islamic Desk Reference, pg. 150. Ed. E. J. Van Donzel. Leiden: Brill Publishers, 1994.

Family background and origins There are two extant genealogies for Ibn Hazm. The first goes back to an ancestor, Yazīd al-Fārisī, who was a Persian mawla of Yazīd ibn Abī Sufyān, brother of Muʿāwiya or his son, the Umayyad caliph Yazīd ibn Muʿāwiya. The full nasab goes ibn Aḥmad ibn Saʿīd ibn Ḥazm ibn Ghālib ibn Ṣāliḥ ibn Khalaf ibn Maʿdān ibn Sufyān ibn Yazīd. According to this genealogy, Ibn Hazm's earliest Muslim ancestor was Yazīd and his ancestor, Khalaf, was the first to enter al-Andalus.

This claim of Persian origin was pushed by the Banū Ḥazm themselves. Ibn Ḥazm's disciple al-Ḥumaydī affirmed this claiming that he was "of Persian origin" (aṣluhu min al-furs). The historian Ibn Khallikān later asserted that Khalaf was the first to arrive to al-Andalus. Furthermore, Ibn Hazm's student Ṣāʿid al-Andalusī and Ibn Hazm's sons also affirmed this Persian origin. A number of later authors would cite this Persian origin including ʿAbd al-Wāḥid al-Marrākushī, Ibn al-Khaṭīb and al-Nuwayrī.

Ibn Ḥayyān, a contemporary of Ibn Khaldun, was the first to question Ibn Khaldun's claimed genealogy. Ibn Ḥayyān denounced this genealogy in his al-Matīn and claimed that the Banū Ḥazm were recent converts only becoming notable through Ibn Hazm's father, Aḥmad. He claimed that they were native to al-Andalus and were an obscure family from Labla (Niebla) whose ancestors lacked nobility.

Most modern Western scholars also deny this lineage. Contemporary Western and Muslim scholars who considered him to be of Spanish origin include , Emilio García Gómez, Reinhart Dozy and Taha al-Hajiri. The scholar David J. Wasserstein argued that the Persian genealogy is mathematically improbable (although not impossible) and concluded that a local Iberian Christian background is the more reasonable assumption. The scholar Maribel Fierro claims that this Persian lineage was claimed not because it was prestigious on its own but would signal that the Banū Ḥazm had been clients of the Umayyads before their arrival to al-Andalus.

Modern scholars of a Muslim background are generally more accepting of Ibn Hazm's claimed Persian lineage. For example, it was accepted by Muhammad Abu Zahra and Muhammad Abu Laila The scholar Abdelilah Ljamai also argued that a man like Ibn Hazm would not lie about his lineage. Although, Wasserstein argued in response that even if Ibn Hazm did not lie about the lineage, it could still be an invented lineage due to an earlier ancestor inventing it.

Early sources (Ibn Ḥayyān, Ṣāʿid al-Andalusī and Yāqūt al-Ḥamawī) generally agree on the links between the Banū Ḥazm and the Huelva region. Although, by Ibn Hazm's time, the family had settled in Cordoba for around two generations according to Ibn Hazm's student Abū Muḥammad b. al-ʿArabī. The historian suggests that the relationship between Ibn Hazm's father and grandfather with the Amirid dynasty could be linked to their roots in this region as the Amirid statesman al-Manṣūr, before his ascent, previously served as qāḍī in Labla.

Furthermore, early sources agree that the Banū Ḥazm originate from a rural settlement known as Munt Līsham (although Yāqūt offers two other spellings: Mutlijatm and Mutlījam). Yāqūt locates Munt Līsham almost 2 miles away from Huelva. The Spanish scholar Miguel Asín Palacios identified this with Casa Montija, an old farmhouse. The sources agree that it was a qarya but differ on whether it was a hamlet (Ṣāʿid and al-Ḥijārī) or a rural estate (Ibn Ḥayyān and Yāqūt).

Early life Ibn Hazm gave an account of his birth to Ṣāʿid al-Andalusī:

Ibn Hazm was brought up in the almunia (villa) of al-Mughīra on the outskirts of al-Zāhira where his father previously settled from his first residence of Balāṭ Mughīth in Cordoba. His father, Abū ʿUmar Aḥmad, was a prominent vizier of al-Manṣūr and his son and successor, al-Muẓaffar. Biographers of Abū ʿUmar Aḥmad described him as a learned, cultured and honest man (min ahl al-ʿilm wa-l-adab wa-l-khayr). Born to a wealthy Cordoban family, Ibn Hazm had a comfortable childhood surrounded by the women of the harem. His early education was exclusively from women and from them, he learnt the Qurʾān, reading and poetry although he viewed this early youth as a waste in terms of attaining knowledge. The scholar Eric Ormsby suggests that Ibn Hazm's upbringing being around women, uncommon for medieval Muslim authors, potentially is a cause for his sensitivity to women but also his harshness. The Spanish Arabist Emilio García Gómez, based on the Ṭawq al-Ḥamāma, describes the child and adolescent Ibn Hazm as "impressionable, sickly, abnormally highly-strung, with a sharp intelligence and moral sense, always on guard against feminine psychology, which he had learned so early on".

In his Ṭawq al-Ḥamāmah (The Ring of the Dove), Ibn Ḥazm records that before the civil war, he fell deeply in love, as a young man, with a sixteen-year-old maidservant of his household. During this youth, Ibn Ḥazm composed poetry on forgetfulness at the request of Ḍanā al-ʿĀmiriyya (a daughter or wife of al-Muẓaffar).

This period of stability ended with the outbreak of civil war (fitna) and the collapse of the Amirid regime in 1008–1009: his father was dismissed from office, briefly imprisoned by the Slav general Wāḍiḥ, and stripped of his wealth. Ibn Ḥazm records that two days after the coup, his family fled to the western part of Cordoba, an episode he dates to Jumādā II 399 AH (February 1009 CE). His brother Abū Bakr died in a plague in 1010–1011, and his father died shortly after, in 1012.

Political upheaval and exiles Ibn Ḥazm never traveled to the East for pilgrimage or study. Wasserstein suggests several possible reasons: the political turmoil and his father's death may have disrupted the family's resources, or it simply was not customary for families of senior Andalusi bureaucrats to study abroad.

In 1013, Berber forces led by the Umayyad claimant Sulaymān al-Mustaʿīn sacked Cordoba, leaving the family home in Balāṭ Mughīth in ruins. The eighteen-year-old Ibn Hazm fled for Almería with his close friend Abū Bakr Muḥammad b. Isḥāq b. Muḥallab.

While in the region, around 1013–1014, Ibn Ḥazm visited Málaga, where he engaged in scriptural debates with the prominent Jewish scholar Ismāʿīl ibn al-Naghrīla (Samuel ha-Nagid). A contemporary from Kairouan, Abū ʿAbd Allāh Muḥammad ibn Kulayb, later described the young Ibn Ḥazm as a "relentless polemicist".

In 1016, the ruler of Almería, Khayrān, accused Ibn Ḥazm of plotting for the Umayyads and exiled him. Ibn Ḥazm and his friend took refuge for several months in the fortress of Ḥiṣn al-Qaṣr, under the governor ʿAbd Allāh ibn Hudhayl al-Tujībī, a location whose precise site remains disputed among historians: Emilio García Gómez argued it likely lay in the region of Málaga or Murcia, while F. Maíllo Salgado proposed a location near Morón. On hearing of a new Umayyad pretender, al-Murtaḍā, the pair sailed to Valencia to join his army in 1018. The campaign ended in a crushing defeat against the Zirids of Granada, and Ibn Ḥazm was imprisoned by Berber forces. It was around this time, or shortly after, that the two friends parted ways, a separation Ibn Ḥazm recalled with pain, describing a tearless farewell to his companion on the beach at Malaga.

Political career Following his release, Ibn Ḥazm secretly entered Córdoba in 1019, lodging with an aloof former slave girl belonging to his family. He then moved to Játiva, where sometime between 1022 and 1027 he composed Ṭawq al-Ḥamāmah (The Ring of the Dove).

Ibn Ḥazm's political position was in some ways paradoxical. Though his family had faithfully served the ʿAmirid dictators, he himself became a vocal partisan of the Umayyad caliphal pretenders. Yet in The Ring of the Dove, he recounts a complex relationship with an ʿAmirid named "Abū ʿĀmir b. Abī ʿĀmir." He wrote that the two initially felt mutual hostility, owing to their fathers' rivalry for the sulṭān's favor and to mutual slanders, but that upon meeting they became the deepest of friends until the man's death. Scholars debate this friend's identity: A.R. Nykl believed he was a son of al-Manṣūr, while Lévi-Provençal and García Gómez identified him as al-Manṣūr's grandson, who briefly ruled Jaén (d. 1030). Wasserstein suggests Ibn Ḥazm may have included this anecdote in a pro-Umayyad context precisely to establish that his family were true Umayyad loyalists who merely happened to maintain a personal relationship with minor ʿAmirids.

In December 1023, Caliph ʿAbd al-Raḥmān al-Mustaẓhir appointed Ibn Ḥazm as vizier alongside his literary friend Ibn Shuhayd and his cousin Abū l-Mughīra. Ibn Ḥayyān reports that this tenure was marred by a bitter rivalry between Ibn Ḥazm and his more handsome and charismatic cousin, who publicly silenced him at court. The caliphate lasted only a month and a half, and Ibn Ḥazm was returned to prison. Ṣāʿid claims Ibn Ḥazm secured a final, brief vizierate under the last Umayyad caliph, Hishām III al-Muʿtadd (r. 1029–1031), before abandoning politics entirely. Despite his reputation as an Umayyad partisan lacking political tact, Wasserstein notes that Ibn Ḥazm pragmatically accepted hospitality and patronage from various non-Umayyad taifa rulers later in life.

Turn to scholarship According to an anecdote relayed by his student Abū Muḥammad Ibn al-ʿArabī, Ibn Ḥazm's dedication to religious scholarship was formally sparked at age 26. Attending a mosque for the funeral of a friend of his father's, he sat down without performing the customary prayers, an omission for which congregants reprimanded him. Ashamed, he immediately sought out the legal scholar Abū ʿAbd Allāh ibn Daḥḥūn to study jurisprudence, spending three years on al-Muwaṭṭaʾ.

Initially studying Mālikism, he transitioned to Shāfiʿism, and eventually became the foremost proponent of strict Ẓāhirism. Al-Ḥumaydī and Ibn Ḥajar al-ʿAsqalānī document his array of teachers, including Abū ʿUmar Ibn al-Jasūr, Yaḥyā ibn Masʿūd, Yūnus ibn ʿAbd Allāh ibn Mughīth, Ḥumām ibn Aḥmad, Muḥammad ibn Bunān, ʿAbd Allāh ibn al-Rabīʿ, ʿAbd Allāh ibn Nāmī, Abū ʿUmar al-Ṭalamankī, ʿAbd al-Raḥmān ibn Khālid, the historian Abū l-Walīd ibn al-Faraḍī, the philosopher Ibn al-Kattānī, Abū ʿUmar ibn ʿAbd al-Barr al-Namarī, and Abū l-Qāsim al-Wahrānī.

Ibn Ḥazm taught the Ẓāhirī method in the Great Mosque of Cordoba alongside Abū l-Khiyār al-Santarīnī between 1027 and 1029, but fierce opposition from the Mālikī establishment led the city's senior magistrate to ban them from teaching. Feeling persecuted, Ibn Ḥazm wrote a qaṣīda to the deposed Cordoban judge Ibn al-Ḥaṣṣār, lamenting his rejection and proclaiming himself the "sun which shines in the heavens of science."

Exiles and theological debates