Almanzor

Abu ʿĀmir Muḥammad ibn ʿAbdullāh ibn Abi ʿĀmir al-Maʿafiri (أبو عامر محمد بن عبد الله بن أبي عامر المعافري), nicknamed al-Manṣūr (المنصور, "the Victorious"), which is often Latinized as Almanzor in Spanish, Almansor in Catalan and Almançor in Portuguese (c. 938 – 8 August 1002), was a Muslim Arab Andalusi military leader and statesman. As the chancellor of the Umayyad Caliphate of Córdoba and hajib (chamberlain) for Caliph Hisham II, Almanzor was effectively ruler of Islamic Iberia.

Born in Turrush to a family of Yemeni Arab origin with some juridical ancestors, ibn Abi ʿĀmir left for Córdoba when still young to be trained as a faqīh. After a few humble beginnings, he joined the court administration and soon gained the confidence of Subh, mother of the children of Caliph Al-Hakam II. Thanks to her patronage and his own efficiency, he quickly expanded his role.

During the caliphate of Al-Hakam II, he held several important administrative positions, including director of the mint (967), administrator for Subh and her children, administrator for intestate inheritances, and quartermaster for the army of General Ghalib ibn Abd al-Rahman (973). The death of the caliph in 976 marked the beginning of the domination of the Caliphate by this functionary, which continued beyond his death with the government of two of his sons, Abd al-Malik al-Muzaffar and Abd al-Rahman Sanchuelo, up to 1009. As chamberlain of the caliphate (from 978), he exercised extraordinary power in the al-Andalus state, throughout the Iberian Peninsula and in part of the Maghreb, while Caliph Hisham II was reduced to near-figurehead status.

His portentous rise to power has been explained by an insatiable thirst for dominance, but historian Eduardo Manzano Moreno warns that "it must be understood within the framework of the complex internal struggles that developed within the Umayyad administration." Deeply religious, he received the pragmatic support of Muslim authorities for his control of political power, though not without periodic tensions between them. The basis of his power was his defense of jihad, which he proclaimed in the name of the Caliph. His image as a champion of Islam served to justify his assumption of governmental authority.

Having monopolized political dominance in the caliphate, he carried out profound reforms in both foreign and domestic politics. He made numerous victorious campaigns in both the Maghreb and Iberia. On the peninsula, his bloody and very destructive incursions against the Christian kingdoms temporarily halted their advance southward.

Origins and youth
Although there are doubts about the exact date of his birth, everything seems to indicate that it occurred around the year 939. He was born into an Arab landowning family of Yemeni origin, belonging to the al-Ma'afir tribe. They had been established since the conquest of Visigothic Iberia in Torrox, a farm by the mouth of the Guadiaro river, belonging to the cora (territorial subdivision) of al-Jazīrah (governed from  al-Jazīrah al-Khaḍrāʾ الجزيرة الخضراء, the site of modern Algeciras). His family had received lands there from Tariq ibn Ziyad as reward to an ancestor, Abd al-Malik, who had distinguished itself in the taking of Carteia during the Moorish-Umayyad conquest of Hispania.

Some of the family had served as Qadis and jurists. The family's position improved significantly with the appointment of ibn Abi ʿĀmir's paternal grandfather as Qadi of Seville and his marriage to the daughter of a vizier, governor of Badajoz and doctor to Caliph Abd al-Rahman III. ibn Abi ʿĀmir's father, Abd Allah, was described as a pious, kind and ascetic man, who died in Tripoli while returning from his pilgrimage to Mecca. His mother, Burayha, also belonged to an Arab family. Even so, the family was middle class, modest and provincial.

Ascent in the Caliphal Court
Though still very young, Ibn Abi ʿAmir moved to Córdoba, where he developed his studies in law and letters under the tutelage of his maternal uncle. This training was intended to facilitate entering the state administration, because the opportunities for advancement in the military were limited to Arabs. Like many other youth from wealthy families, he received training in interpretation of the Quran, prophetic tradition and application of Sharia, thus completing his education as a faqīh, with the intention of becoming a judge, and from this time he retained his taste for literature. Instructed by renowned masters of Islamic legal tradition and letters, he showed talent in these studies.

The death of his father and the bad family situation led him to abandon his studies and take the profession of scrivener. After occupying a modest position as a scribe along the alcázar and mosque of Córdoba – close to the offices of the Administration – to earn his livelihood, the youth soon stood out for his talent and ambition and he began his political career as a clerk in the audience chamber of the capital's chief Qadi, Muhammed ibn al-Salim, an important advisor to the Caliph Al-Hakam II despite the fact that his positions were exclusively religious and not political. Ibn Abi ʿĀmir soon caught the attention of Vizier Ja'far al-Mushafi, head of the civil administration, who would introduce him to caliphal court, probably on the recommendation of Ibn al-Salim. Already noted for his knowledge and professional competence, he began to accumulate positions in the Administration. Ibn Abi ʿĀmir, in his thirties, was one of the young functionaries who took part in a generational turnover of the court at the beginning of Al-Hakam's reign.

In late February of 967, he was given charge of Abd al-Rahman, son and heir of Al-Hakam II by his favorite, the Basque Subh (Aurora), a slave with very diverse training, from singing to Islamic jurisprudence to poetry, who owed her power to her ascendancy over the caliph as the mother of his children. With her, Ibn Abi ʿĀmir established a privileged relationship extremely beneficial for his career. Although his role was probably secondary, his responsibility managing the estates of the heir to the throne and those of his mother granted Ibn Abi ʿĀmir close proximity to the reigning family, and he quickly began to accumulate important positions. Seven months after his first appointment, and thanks to the intercession of the royal favorite, he became director of the mint, and in December 968, he was named treasurer of the vacant inheritances. The following year he was promoted to Qadi of Seville and Niebla, one of the most important in the state, and at the death of his charge Abd al-Rahman in 970, he was placed in the same role for the young heir, Hisham. By this time he had married the sister of the head of the caliphal guard, a client of the new heir, and began to accumulate wealth. A residence was built in al-Rusafa, near the former palace of Abd al-Rahman I, and he began to make sumptuous gifts to the Caliph's harem. He was accused of embezzlement and removed from his post as head of the mint in March 972, but was helped financially to cover the alleged embezzlement. He obtained a police command and he retained his responsibility for the heir and intestate estates.

In 973, he undertook the logistical, administrative and diplomatic aspects of the caliphal campaign against the Idrisids in the Maghreb, with the official position of High Qadi of the Umayyad possessions in North Africa. The importance of the fleet in the campaign and its dependence on Seville, where Ibn Abi ʿĀmir was Qadi and therefore had responsibility for its facilities, and the confidence of the caliph himself and his chamberlain, facilitated his acquisition of this appointment. The commission brought with it authority over civilians and military personnel and, in practice, the supervision of the campaign. A primary responsibility of his role was to obtain the submission of the notables of the region by giving them formal gifts, the acceptance of which indicated their acceptance of the Caliph's authority and a promise of loyalty. Along with military victories, this undermined the enemy's position.

Achieving victory against the Idrisids, Ibn Abi ʿĀmir returned sick to the Cordoban court in September 974, intending to recover and resume his duties. He never returned to North Africa. His experience as a supervisor of the enlisted troops for the Maghreb campaign gave him an appreciation for their possible political utility if he gained control. It also allowed him to establish relations with the tribal leaders of the area and with his future powerful father-in-law, Ghalib ibn Abd al-Rahman, who had led the military aspects of the operation. Ibn Abi ʿĀmir's ability to manage organizational and economic aspects of the campaign was widely recognized, and rewarded months before with his reappointment as head of the mint, and was the beginning of his political success. In the last months of Al-Hakam's illness, he appointed Ibn Abi ʿĀmir inspector of professional troops, which included the bulk of the Berbers brought from the Maghreb by the caliph to try to form a force loyal to his person, which guaranteed him access to the throne of the Caliph's young son.

Elimination of pretenders and formation of triumvirate
The death of Caliph Al-Hakam II on 1 October 976 and the proclamation of his son Hisham as his successor inaugurated a new period in the political career of Ibn Abi ʿĀmir, and also represented a pivotal event in the history of the Caliphate, which thereafter was marked by his tenure and by the gradual withdrawal of the third Caliph. Al-Andalus went through a serious succession crisis at this time, because the designated successor, Hisham, born in 965, was too young to rule. He had been only eight or nine years old in 974 when his father first introduced him to the process of government, and was still a minor when his father died. This was an extraordinary situation because neither the emirate nor caliphate had previously been in the hands of a child. Some schools of Islamic jurisprudence rejected the possibility of a minor becoming Caliph, but the Umayyad Al-Andalus tradition had secured the inheritance from parent to child, while the case of Abd al-Rahman III set a precedent for primogeniture. Faced with this situation, and despite the efforts of Al-Hakam during the last years of his reign to ensure the succession of his son by associating him with the tasks of government, there was division on the succession. Some favored the appointment of a regent, the chamberlain al-Mushafi, while others preferred to give the caliphal title to one of the brothers of the deceased Caliph, the twenty-seven-year-old al-Mughira, who was the favorite younger son of Abd al-Rahman III.

Two prominent Eastern European slaves (saqaliba) occupying important court positions – one, the uncle of the new Caliph – who were present at Al-Hakam's death decided to take action before this division was more widely known. They moved to place al-Mughira on the throne, with the condition that he name his nephew Hisham as his heir, and to remove the chamberlain, al-Mushafi, thereby giving them ascendance at court over the faction supporting Hisham. The two, who would nonetheless occupy prominent places in the ceremony proclaiming Hisham once their plan was thwarted, had the support of the thousand saqalibas of the court and control of the palace guard. The chamberlain, who was the real center of political power after the death of al-Hakam and even in the last years of his reign, had pretended to support the conspirators, only to subvert them thanks to the support of Berber troops. He quickly broke up the plot with the help of Subh, and instructed Ibn Abi ʿĀmir, then a senior official and member of the court with privileged access to the young Caliph and his mother, to murder the pretender. The support of Ibn Abi ʿĀmir, the right hand of Subh, for the young caliph was crucial to his rise to power.

A reluctant but obedient Ibn Abi ʿĀmir surrounded al-Mughira's residence with a detachment of one hundred soldiers, broke in and notified al-Mughira of the death of al-Hakam and the enthronement of Hisham II. The young uncle of Hisham expressed his loyalty, and in the face of Almanzor's doubts, demanded compliance with the order for his own assassination. Al-Mughira was then strangled in front of his family in the living room of his house, and hung on a beam of the roof of an adjacent structure as if he had committed suicide. Al-Mushafi and Ibn Abi ʿĀmir thus fulfilled the wishes of their late master to ensure the accession of Hisham. The young Caliph's supporters relied on the Berber guard, created by al-Hakam for his son, to face the saqalibas, more than eight hundred of which were expelled from the palace as a result of the crisis.

Hisham II was invested as caliph on or about Monday, 1 October 976, with the title of al-Mu'ayyad bi-llah, ("one who receives the assistance of God"). Ibn Abi ʿĀmir participated in the ceremony, recording in the minutes the oaths of fidelity the attendees made before the cadí. A week later, 8 October 976, Hisham named al-Mushafi hajib – chamberlain or prime minister – and made the 36-year-old Ibn Abi ʿĀmir the vizier and delegate of the hajib. The latter thus maintained a position of singular importance as the link between the new Caliph's mother, in practice representing the government during the minority of Hisham, and the administration headed by al-Mushafi. The power was effectively in the hands of a triumvirate formed by chamberlain al-Mushafi, the vizier Ibn Abi ʿĀmir and General Ghalib. Subh, who had been associated with them in the past and now ruled in a way on their behalf; this triumvirate reported all important matters to her and consulted her and acted with her permission. They knew very well that without her support they could not win and stay in power in the uncertain and dangerous political spiral of the court, so they tried very hard to please her. To boost the popularity of the new Caliph among the population, and strengthen their own positions, they abolished the unpopular oil tax.

Ruin of al-Mushafi
While the alliance between Ibn Abi ʿĀmir and al-Mushafi had undermined the traditional power of the court slaves, relations between the two soon deteriorated. The Chamberlain's failure to address the loss of prestige due to the succession intrigue and Christian incursions that in 976 almost reached the capital allowed Ibn Abi ʿĀmir to gain control of army troops in the capital of the Caliphate after assuring Subh of his ability to restore that military prestige. Ibn Abi ʿĀmir, unlike the chamberlain, was inclined towards the military response to Christian incursions and was willing to command a retaliatory strike. Al-Mushafi, however, had advocated a defensive strategy, that, despite Cordoban military power, had conceded the territories north of the Guadiana to the Christian states. At the same time, and also thanks to the influence of Subh, Ghalib obtained the government of the Lower March and command of the border armies.

In February 977, Ibn Abi ʿĀmir left the capital for his first campaigning season in Salamanca, following the strategy of containment of the Christian states maintained during the previous reign. His appointment as warden – head of an army – of the capital's troops drew him into alliance with Ghalib – the warden of the border armies – and brought about the end of the triumvirate that the two had formed with al-Mushafi. In his first campaign, lasting nearly two months, he plundered the outskirts of the baths at Baños de Ledesma. and brought two thousand captured prisoners to Cordoba, but failed to take any fortresses. In autumn, he attacked Salamanca.

Ibn Abi ʿĀmir won military prestige by repulsing Christian forces and attacking Cuéllar during a second 977 campaign, and Salamanca in the autumn of the same year, not for conquest, but to weaken the enemy and gain domestic popularity. This new prestige allowed him to apply for the post of prefect of Córdoba, a role until then filled by a son of al-Mushafi. The new military reputation of Ibn Abi ʿĀmir, with the support of the harem and of Ghalib, allowed him to obtain the position without the chamberlain's consent. This led to open confrontation between Ibn Abi ʿĀmir, hitherto an apparent faithful and efficient servant of the chamberlain, and al-Mushafi. The latter owed his power to the support of the previous caliph, and lacked firm support, being considered an upstart by the leading families in Córdoba's governing administration. He tried to counter the alliance between the other two members of the triumvirate by marrying another of his sons to Ghalib's daughter, Asma. Ibn Abi ʿĀmir, who had won the favor of the cunning mother of the Caliph, of Ghalib, and of major families of the civil service, skillfully intervened, using the intercession of Subh and directly addressing Ghalib to encourage him to withdraw his initial approval and instead allow Ibn Abi ʿĀmir himself to wed Ghalib's daughter. The magnificent wedding was held in the spring of 978, eight months after the signing of the marriage contract sealed the alliance between Ghalib and Ibn Abi ʿĀmir and marked the decline of the power of the chamberlain. A few days after the wedding, Ghalib and Ibn Abi ʿĀmir left for a new campaign targeting Salamanca. Military successes increased the power of the two allies and further undermined the chamberlain at court. The two wardens received new titles as reward for their victories, and Ibn Abi ʿĀmir was named 'double vizier', for Interior and Defense, the two most important vizierships. Ghalib had been given the title of chamberlain at the end of 977 – an unprecedented situation as there had never been two chamberlains at the same time – depriving al-Mushafi of most of his duties, and al-Mushafi was subsequently dismissed and imprisoned. His relatives and supporters in positions of the Administration were arrested and his possessions confiscated. Ibn Abi ʿĀmir succeeded the defeated al-Mushafi as a second chamberlain for the Caliphate. The most important supporting positions were held by trusted people, in some cases family members. The elimination of the old chamberlain reduced the visibility of the Caliph, and Ibn Abi ʿĀmir gradually became the intermediary between his lord and the rest of the world. Aware that his power emanated from Hisham, Mansur was careful, however, to continue to maintain the appearance of the minor's sovereignty.

Dissatisfaction with the royal minority and the regency fueled a new rebellion organized by prominent members of the court at the end of 978. The conspirators intended to replace Hisham with one of his cousins, a grandson of Abd al-Rahman III. An improvised attempt to stab the Caliph to death failed and led to the brutal repression of the conspirators at the insistence of Subh and Ibn Abi ʿĀmir, not without overcoming the resistance of major legal advisors. This ended attempts to replace the Caliph with another member of the Umayyad dynasty, resulting in the flight of any possible pretender from the capital, the close surveillance of members of the Umayyad family, and the construction the following year of a new fortified residence for Ibn Abi ʿĀmir, Medina Alzahira (the "Resplendent City"), work that went on until 989. This new residence, located east of the city, housed troops loyal to Ibn Abi ʿĀmir and the governmental administration and was the center of a sumptuous court. In addition, to calm the malaise among the faqīh caused by the repression of the conspirators against Hisham's legitimacy, in which some had colluded, he established a commission to expunge Al-Hakam's library.

As a chamberlain, in the summer he had directed a new campaign that lasted more than two months, this time in the northeast against Pamplona and Barcelona. In the fall he made a new incursion into Ledesma lasting just over a month. In May the following year, he directed a new campaign in this region. The next incursion, during the summer, marched to Sepulveda. In September 979, he sent troops from Algeciras to the aid of Ceuta, threatened by the victorious campaign of Buluggin ibn Ziri, supported by the Fatimids, against Umayyad clients in the Western Maghreb. Later, the city became the center of Algerian Maghreb politics.

Showdown with Ghalib ibn Abd al-Rahman
Having crushed the opposition at court, the two co-leaders soon clashed. The old general resented prostrating before Ibn Abi ʿĀmir, who had devoted himself to strengthening his power and controlling access to the caliph. Ghalib believed the maneuvers of his ally, including the construction of his new palatial residence, the reinforcement of the Berber military units, and his increasing control over the Caliph, would eventually damage the dynasty. For his part, Ibn Abi ʿĀmir viewed his father-in-law's continued military prestige as obscuring his own military prowess, despite successive victorious campaigns. After several joint raids into Christian lands, mainly led by the veteran Ghalib despite the growing military experience of Ibn Abi ʿĀmir, a confrontation erupted in the spring of 980, over a campaign around Atienza. Betrayed by Ghalib and wounded, his life only saved through the intercession of the Qadi of Medinaceli, Ibn Abi ʿĀmir reacted by immediately attacking the fortress where his father-in-law's family was, and looted it once taken. Almanzor continued north, but the confrontation with Ghalib, fortified in Atienza, ended the larger campaign, intended to be his second against Castile since 975. Ghalib was forced into exile in Christian territory. In the fall, Mansur led a new offensive against 'Almunia', which is unidentified. Then in 981, a year of great martial activity for Ibn Abi ʿĀmir, he sent five military campaigns north, the first in February and March.

After several clashes between the co-leaders that ended favorably for Ibn Abi ʿĀmir, in April of 981, Ghalib, allied with Castile and Pamplona, defeated him. In May, Ibn Abi ʿĀmir counterattacked after having united Berber troops, his own Cordoban men, and some of the border units that his enemy had long commanded. Ghalib, meanwhile, had the backing of another part of the Caliphate's border forces and his Castilian and Navarese allies. On the verge of achieving victory over his son-in-law on in the Battle of Torrevicente on 10 July 981, Ghalib was found dead in a ravine without signs of violence. He may have died of natural causes, being almost eighty years old. The troops of his rival, disconcerted by the death of their leader, largely passed to Ibn Abi ʿĀmir's flag. Ghalib's body was severely mutilated, first by his own troops at the direction of Ibn Abi ʿĀmir, who wanted to prove his enemy's death, and then exposed in Córdoba. Several of his main allies were also killed in the battle, which gave the winner the nickname, Almanzor, ("the Victorious") by which he is known to history. The passing of Ghalib made him sole chamberlain and allowed him to eliminate any possible opponents at court, although his legitimacy came only from his position as regent and the tolerance of the Caliph's mother. With the elimination of Ghalib, the power of the Caliph became concentrated in his person.

That same year, he looted Zamora and its surroundings in September. A month later, he attacked Portuguese lands, probably Viseu.

Alliance with the queen mother and troubled government
For twenty years, until the breakup of his alliance with the caliph's powerful mother in 996, Ibn Abi ʿĀmir acted in part as her representative, advisor, treasurer, mediator, informant, and her commander of the armies and the police. It was she who made most of the decisions, in consultation with her son's regents. She was aware of all the political developments of the government and the court and was a dominant force in factional struggles. Subh had a lot of trust and affection for Almanzor, and her support for him was so obvious to everyone that it caused rumors that they were in love. From the reign of Caliph Al-Hakam II to the new Caliph Hisham, it was Subh's patronage, apart from his own ability, that promoted him and removed his opponents from the court.

Despite years of competition at court for power and administration by others, however, the Caliph, upon reaching his majority, made no move to assume control, possibly due to some kind of illness or other inability to carry out the responsibilities of his position. The historian, Al-Dhahabi, attributes Almanzor's locking up the Caliph to the latter being "feeble minded, believing what can't be true". For example, someone brought him a piece of rock, saying it is from Jerusalem's site of the prophet's ascent to heaven. The Caliph rewarded him with a lot of gold. In another instance, someone presented him with a donkey's hoof, claiming it is Uzair's donkey, and he was also rewarded. Yet another person brought him hair, claiming it is the prophet's.

Almanzor not only assumed the caliphal power, but also roles as guardian of the incapacitated Caliph and guarantor of dynastic power. The fact that he merely controlled the administration and army on behalf of Hisham, however, made him expendable, so he took steps to strengthen his position. The capital was placed in the hands of a cousin of his, who controlled it tightly, and he elevated a series of supporters, generally unpopular and considered despotic, who managed to gain control of various Taifas after the disintegration of the Caliphate. He also allied himself with important border lords.

In 988 and 989 he had to face a double threat: a long drought that caused famine and forced him to apply some social measures to alleviate the shortage (delivery of bread or rescission of taxes, among others) and the emergence of a new rebellion against him in which his eldest son sought to replace him. Almanzor managed to disrupt the conspiracy, which had been joined by the governor of Zaragoza, ʿAbd al-Raḥmān ibn Muhammad of the Banu Tujib, and that of Toledo, an Umayyad descendant of Caliph Al-Hakam I, 'Abd Allah bin Abd al-'Aziz al-Marwanid also known as Abdullah Piedra Seca, but his efforts to get his son to submit proved fruitless. The latter took refuge with the Castilians after the arrest of his fellow conspirators. Almanzor launched a successful campaign against Castile and took custody of his wayward son, who was tried and beheaded at dawn on 8 September 990. Almanzor, still reeling from his eldest son's betrayal, disowned him, while also ordering those who had killed him at Almanzor's command to themselves be executed. The governor of Zaragoza would be executed in his presence while he spared the life of Piedra Seca--perhaps because Almanzor did not want to stain his hands with Umayyad blood.

Almanzor also clashed with some of his enemy's satirical poets, including Abu Yafar al Mushafi (d. 982) and Yûsuf ibn Hârûn al-Ramâdî (d. 1012–3), known as Abû Ceniza. Persecuted and subsequently forgiven, Abû Ceniza went to Barcelona in 986. Ibrahim ibn Idrís al-Hassani also paid for his satire of Almanzor with exile in Africa. Almanzor threw the poet Abu Marwan al-Jaziri in prison, where he died in 1003.

Rupture with Subh and concentration of political power
With Ghalib eliminated and Hisham unable to perform his duties as Caliph, Almanzor began to weigh preparing for the succession, and even the possibility of officially taking power. In 989, he tried unsuccessfully to have the faqīhs accept his home, Medina Alzahira, as a major mosque. From 991 he positioned his son Abd al-Malik in a similar way as Al-Hakan had done with Hisham, appointing him chamberlain and supreme warden of the Caliphate's armies, although Almanzor did not step aside from those roles himself. At the same time, he discreetly presented to the faqīhs who advised the senior Qadi the possibility that he himself might replace the Caliph because Hisham was incapable and no one else in the state could hold the position. The regency, formerly founded on Hisham's minority, could no longer be justified by his mere inability to carry out his functions. The opinion of the faqīhs, however, was negative: if not Hisham, according to the legal experts, power should devolve to another member of the tribe of Muhammad. Almanzor reluctantly accepted the decision, and in the following years he gradually assumed even greater powers, corresponding to those of the Caliph: he confirmed the official appointments with his own seal rather than that of the Caliph, in spite of nominally acting on his behalf, he appointed a new mint official, appropriated new titles and moved part of the administration to Medina Alzahira. He also had his name mentioned after that of the Caliph in Friday prayers and maintained a court parallel to that of the sovereign at al-Zahira. In 991, under pressure from the chamberlain, the council of faqīhs changed their unfavorable opinion as to the conversion of Medina Alzahira into a major mosque, although its use continued to be frowned upon by many notable Cordobans.

His attempts to seize power ended the long alliance between Almanzor and Subh in 996. After twenty years as a representative of Subh, Almanzor confronted the Caliph's mother and her supporters. After the collapse of the alliance, Subh tried with all her might to eliminate Almanzor and united with all his opponents and enemies and divided the court into two factions, a group supporting Almanzor and the survival of his power and another group supporting Subh whose goal was to take over the government by her son. The clash between the two cliques was triggered by Subh withdrawing eighty thousand dinars from the royal treasury to finance an uprising against the chamberlain. Almanzor discovered this thanks to his agents in the palace, and he reacted by successfully petitioning the council of viziers and Faqīhs to transfer the treasury to his residence, Medina Alzahira, characterizing Subh's theft as a robbery by the harem. With Almanzor sick, Subh took over the palace and tried in vain to block the transfer. Abd al-Malik, Almanzor's son, won the support of the viziers. The Caliph repudiated the rebellion of his mother in late May 996, and Abd al-Malik took custody of both him and the treasure. Though the rebellion she headed on the peninsula lost steam due to loss of funding and the rapid defeat of its few supporters, the money she had previously taken allowed Subh to finance a rebellion in the Maghreb. Although Almanzor had not yet managed to quell this revolt by fall 997, it failed to gain any support on the peninsula.

To reinforce his image and that of his son and successor, Almanzor organized a parade with the Caliph and his mother. The gesture served to dispel any doubts about the support of the Caliph for Almanzor, and thus refuted the allegations of Ziri ibn Atiyya, launched from the Maghreb. After the procession, Hisham was locked up – with all the comforts but without power – in Medina Alzahira, where his mother was probably also imprisoned. Having lost her confrontation with her former ally, she died shortly thereafter in 999. Almanzor, who had renewed his oath of allegiance to the Caliph with the proviso that he delegate his powers to his family, was strengthened. He sent his son to fight the North African rebellion, and took charge of all administrative power. He counted on the approval of the religious leadership who, fearing possible civil war, supported Almanzor's position as guarantor of stability and of the throne of the impotent Hisham. State power was divided in two: with Almanzor blocking exercise of the symbolic and legitimate power of the Caliph, while that of the chamberlain and his successors, devoid of legitimacy for being Yemeni Mofarite and not of the Prophet's blood, controlled the Caliphate's policy.

Reform of army and administration
The separation between the temporal power, held by Almanzor, and the spiritual, in the hands of Hisham as Caliph, increased the importance of military force, a symbol – along with the new majesty of the chamberlain's court, rival of that of the caliph himself – of the power of Almanzor, and an instrument to guarantee the payment of taxes.

Almanzor successfully continued the military reforms begun by Al-Hakam and his predecessors, covering many aspects. On one hand, he increased the professionalization of the regular army, necessary both to guarantee his military power in the capital and to ensure the availability of forces for his numerous campaigns, one of the sources of his political legitimacy. This policy de-emphasized levies and other non-professional troops, which he replaced with taxes used to support the professional troops—often saqalibas or Maghrebis—which freed the natives of al-Andalus from military service. Recruitment of saqalibas and Berbers was not new, but Almanzor expanded it. On the other hand, he created new units, unlike the regular army of the Caliphate, that were faithful primarily to himself and served to control the capital. Emir Abd al-Rahman I had already used Berbers and saqalibas for a permanent army of forty thousand to end the conflicts that hitherto had plagued the emirate. At the time of Emir Muhammad I, the army reached thirty-five to forty thousand combatants, half of them Syrian military contingents. This massive hiring of mercenaries and slaves meant that, according to Christian chroniclers, "ordinarily the Saracen armies amount to 30, 40, 50, or 60,000 men, even when in serious occasions they reach 100, 160, 300 and even 600,000 fighters." In fact, it has been argued that, in Almanzor's time, the Cordovan armies could muster six hundred thousand laborers and two hundred thousand horses "drawn from all provinces of the empire."

In order to eliminate a possible threat to his power and to improve military efficiency, Almanzor abolished the system of tribal units that had been in decline due to lack of Arabs and institution of pseudo-feudalism on the frontiers, in which the different tribes each had their own commander and that had caused continuous clashes, and replaced it with mixed units without clear loyalty under orders from Administration officials. The nucleus of the new army, however, was formed increasingly by Maghrebi Berber forces. The ethnic rivalries among Arabs, Berbers and Slavs within the Andalusi army were skillfully used by Almanzor to maintain his own power--for example, by ordering that every unit of the army consist of diverse ethnic groups so that they would not unite against him; and thus preventing the emergence of possible rivals. However, once their centralizing figure disappeared, these units were one of the main causes of the 11th-century civil war called the Fitna of al-Andalus. Berber forces were also joined by contingents of well-paid Christian mercenaries, who formed the bulk of Almanzor's personal guard and participated in his campaigns in Christian territories. Almanzor's completion of this reform, begun by his predecessors, fundamentally divided the population into two unequal groups: a large mass of civilian taxpayers and a small professional military caste, generally from outside the peninsula.

The increase in military forces and their partial professionalization led to an increase in financial expenses to sustain them. This represented an additional incentive to carry out campaigns, which produced loot and land with which to pay the troops. These lands, when handed over to the soldiers as payment, were thereafter subject to tribute and ceased to operate under a system of border colonization. The Caliphal army was funded by the taxpaying farmers in exchange for military exemptions, and consisted of local recruits as well as foreign mercenaries – Berber militias, Slav and Black slaves, mercenary Christian companies and jihadi volunteers. At that time al-Andalus was known as Dar Jihad, or "country of jihad", and attracted many volunteers, and though these were relatively few compared to the total army, their zeal in combat more than compensated for this.

According to modern studies, these mercenary contingents made it possible to increase the total size of the Caliphal army from thirty or fifty thousand troops in the time of Abd al-Rahman III to fifty or ninety thousand. Others, like Évariste Lévi-Provençal, argue that the Cordoban armies in the field with the Almanzor were between thirty-five thousand and seventy or seventy-five thousand soldiers. Contemporary figures are contradictory: some accounts claim that their armies numbered two hundred thousand horsemen and six hundred thousand foot soldiers, while others talk about twelve thousand horsemen, three thousand mounted Berbers and two thousand sūdān, African light infantry. According to the chronicles, in the campaign that swept Astorga and León, Almanzor led twelve thousand African and five thousand Al Andalus horsemen, and forty thousand infantry. It is also said that, in his last campaigns, he mobilized forty-six thousand horsemen, while another six hundred guarded the train, twenty-six thousand infantry, two hundred scouts or 'police' and one hundred and thirty drummers. or that the garrison of Cordoba consisted of 10,500 horsemen and many others kept the northern border in dispersed detachments. However, it is much more likely that the leader's armies, even in their most ambitious campaigns, may not have exceeded twenty thousand men. It can be argued that until the eleventh century no Muslim army on campaign exceeded thirty thousand troops, while during the eighth century the trans-Pyrenean expeditions totaled ten thousand men and those carried out against Christians in the north of the peninsula were even smaller.

In the time of Emir Al-Hakam I, a palatine guard of 3000 riders and 2000 infantry was created, all Slavic slaves. This proportion between the two types of troops was maintained until Almanzor's reforms. The massive incorporation of North African horsemen relegated the infantry to sieges and fortress garrisons. This reform led to entire tribes, particularly Berber riders, being moved to the peninsula.

The main weapon of the peninsular campaigns, which required speed and surprise, was the light cavalry. To try to counteract them, the Castilians created the role of "villain knights" – ennobling those free men who were willing to keep a horse to increase the mounted units – through the Fuero de Castrojeriz of 974. For similar reasons, the Barcelonan count Borrell II created the figure of the homes of paratge- who obtained privileged military status by fighting against the Cordobans armed on horseback – after losing their capital in the fall of 985. In contrast to the prominent role the navy had played in previous decades under Abd al-Rahman III, under Almanzor it served only as a means of transporting ground troops, such as between the Maghreb and the Iberian Peninsula, or Alcácer do Sal's ships in the campaign against Santiago de Compostela in 997.

During this time, military industry flourished in factories around Córdoba. It was said to be able to produce a thousand bows and twenty thousand arrows monthly, and 1300 shields and three thousand campaign stores annually.

As for the fleet, its network of ports was reinforced with a new base in the Atlantic, in Alcácer do Sal, which protected the area of Coimbra, recovered in the 980s, and served as the origin of the units that participated in the campaign against Santiago. On the Mediterranean shore, the naval defense was centered at the base of al-Mariya, now Almería. The dockyards of the fleet had been built in Tortosa in 944.

Initially the maritime defense of the Caliphate was led by Abd al-Rahman ibn Muhammad ibn Rumahis, a veteran admiral who had served Al-Hakam II and was Qadi of Elvira and Pechina. He repulsed raids by al-Magus (idolaters) or al-Urdumaniyun ('men of the north', vikings), in the west of al-Andalus in mid-971; at the end of that year, when they tried to invade Al Andalus, the admiral left Almería and defeated them off the coast of Algarve. In April 973, he transported the army of Ghalib from Algeciras to subdue the rebellious tribes of the Maghreb and end Fatimid ambitions in that area. As in 997, when the Al Andalus fleet hit the Galician coast, in 985 it had ravaged the Catalans. During the Catalan campaign, Gausfred I, Count of Empurias and Roussillon, tried to gather an army to help the locals but then several flotillas of Berber pirates threatened their coasts, forcing them to stay to defend their lands.

To ensure control of the military, Almanzor eliminated the main figures who could have opposed his reforms: in addition to the death of Ghalib, the participation of the governor of Zaragoza in the plot of his eldest son served as a justification to replace him with another, more amenable, member of the same clan, the Banu Tujib. The admiral of the fleet, who maintained a significant budget, was poisoned in January 980 and replaced by a man faithful to Almanzor.

As in the Army he encouraged the recruitment of Berbers faithful to him, so in the Administration he favored the saqalibas to the detriment of native officials, again with the aim of surrounding himself with personnel loyal only to him.

Land transport routes were dotted with strongholds, since ancient Al Andalus dignitaries sought to control communications. Messengers were bought in Sudan and specially trained to handle Almanzor's messages and to transmit the official reports that his foreign ministries wrote about the annual campaigns.

The Caliphate ruled by Almanzor was a rich and powerful state. According to Colmeiro, it is estimated that in a pre-industrial society, for every million inhabitants, ten thousand soldiers could be mustered. Even assuming the chronicles exaggerated tenfold the real numbers – these speak of eight hundred thousand soldiers – the caliphate could have had eight million inhabitants. Those who use more bullish criteria estimate between seven and ten million, but the population was probably much fewer. Traditionally speaking, around the year 1000, the caliphate occupied four hundred thousand square kilometers and was populated by three million souls. By comparison, the Iberian Christian states comprised one hundred and sixty thousand square kilometers and half a million people. By the 10th century, 75% of the population under the Umayyads had converted to Islam, a number reaching 80% two centuries later. By comparison, at the time of the Muslim invasion, Spain had about four million inhabitants, although there is no shortage of historians who would raise that estimate to seven or eight million.

His realm also had large cities like Córdoba, which surpassed one hundred thousand inhabitants; Toledo, Almería and Granada, which were around thirty thousand; and Zaragoza, Valencia and Málaga, all above fifteen thousand. This contrasted sharply with the Christian north of the peninsula, which lacked large urban centers.

Defense of religious orthodoxy and legitimation of power
One of the instruments Almazor used to strengthen his power was his court, at which writers and poets celebrated his virtues—praise that was used as propaganda among the people.

The stability and prosperity of the regime and its rigorous defense of Islam, which Almanzor showed through various pious gestures, gave him popular support. Also numbered among these gestures were copying a Koran that he took with him during his campaigns, and the expansion of the mosque of Cordoba (987–990). The political ambitions of the chamberlain had important repercussions on culture and religion, which he was forced to support. His image as Islam's leader led to the censorship of some sciences considered non-Islamic, and to the purging from Al-Hakam's important library of works considered heretical. His political interests required him to ingratiate himself with the lawyers when his power was still unsteady, and led him to censure logic, philosophy and astrology, despite his appreciation for culture. His meddling in religious matters led to the appointment of his own uncle, himself a veteran qadi, as the principal qadi after the death of the hostile Ibn Zarb, who had opposed some of his proposals. The main expression of his defense of religion, however, was his military campaigns against the Christian states, a method of legitimization that the caliphs had used before but which Almanzor took to extremes. Successive victories, despite their transient benefits to the realm, had a great propaganda effect, both in the Caliphate and in the enemy states of the north. To each crisis of his political career, he responded with large and/or multiple military campaigns.

The campaigns also had a beneficial economic effect because of the loot – especially abundant slaves – obtained by them and because of the security they granted to the borders.

The Maghreb campaigns
The meager Cordoban cereal production forced the Umayyads to obtain stocks from the Maghreb, and, thus, to oppose Fatimid expansion in the region, which jeopardized their supply. At stake was commercial control of the western Mediterranean. Unlike his campaigns on the Iberian Peninsula and with the exception of the one carried out jointly with Ghalib at the beginning of his career, Almanzor did not take a personal role in the fighting in the Maghreb, but simply a supervisory one. The effective direction of the fight was in the hands of subordinates, whom he would ceremonially accompany to Algeciras to see off the troops as they crossed the strait.

Abd al-Rahman III had conquered Ceuta and Tangier and fortified them in 951, but he had not been able to prevent the Fatimids from taking control of the Maghreb in 958–959, after burning the Umayyad fleet in Almería in 955. In 971, Umayyad clients suffered another heavy defeat. The Fatimid march to Egypt around 972 benefitted the Umayyads, who were left facing a Fatimid client, the Sanhaja Berber Buluggin ibn Ziri.

The Caliphate's strategy began by the fortification of Ceuta, manned by a large garrison. In May of 978, the Zenata tribes seized the city of Sijilmasa, at the northern end of the trans-Saharan gold, salt and textile trading routes, and where they founded a pro-Córdoba principality ruled by Jazrun ibn Fulful, the city's conqueror. The success of the Umayyad political machine, continued by Almanzor, allowed him to concentrate the offensive power of the Berber tribes on the expansion of the regions that recognized his legitimacy and limited clashes among those accepting Córdoba's protection. This conquest, which gave great prestige to Hisham and Almanzor—and affronted the Fatimids because it was the city where its founder had appeared before the Berber Kutama tribe--allowed them to counteract the influence of the Fatimids who, after moving to Egypt, had left these regions under the control of the Zirid dynasty. Ibn Ziri launched a victorious campaign that temporarily disrupted the Zenata and allowed him to recover much of the Western Maghreb before besieging Ceuta. The refugees there asked for help from Almanzor, who sent a large army that he accompanied as far as Algeciras, to repulse Ibn Ziri, who decided to retire although he continued harassing Umayyad supporters until his death in 984. The effects of Ibn Ziri's inroads, however, were transient: at his death most of the tribes of the region once again accepted Cordoban religious authority.

In 985, before the Idrisid Al-Hasan ibn Kannun, who had proclaimed himself Caliph, returned from his refuge in the Fatimid court in Egypt, Almanzor saw off a new army that crossed the Maghreb to confront him under command of his cousin. Reinforcements were later dispatched, commanded by the eldest son of Almanzor, and his father-in-law, the governor of Zaragoza. Overwhelmed, the Idrisid negotiated his surrender and proceeded to the Cordoban court, but Almanzor had him assassinated on his way to the city, and later executed his cousin who had granted safe conduct to the rebel.

The disagreements among the various tribal leaders loyal to the Umayyads did produce one crisis: the favor shown by Almanzor to Ziri ibn Atiyya of the Maghrawa Berbers upset other chiefs, who ended up rising in arms. They defeated the Cordoban governor of Fez, who died in combat, and Ibn Atiyya in April 991. After this defeat, Almanzor understood the need to grant control of the region to local Berber leaders instead of trying to govern through Iberian delegates. This strategy aimed to attract the support of local tribes to the Umayyads. Fundamentally, the fate of the campaigns depended on the changing loyalties of the various tribal leaders, although, in general, the Zenata supported the Umayyads while the Sanhaja supported the Fatimids. Almanzor unsuccessfully attempted to divide the territory between Ibn Attiya and another tribal chief who had abandoned the Fatimids—the uncle of al-Mansur ibn Buluggin, son and successor of Buluggin ibn Ziri. So, Almanzor gave all lands controlled by the Caliphate to Ibn Atiyya, who managed to defeat the rebels and supporters of the Fatimids in 994, and founded a small principality centered on Oujda.

The crisis between Almanzor and the royal family in 996–998 caused a confrontation between him and Ibn Atiyya, who considered Almanzor's attitude towards the Caliph to be disrespectful. Seeing in Ibn Atiyya a threat to his power, Almanzor dismissed him and sent forces to combat him. The Banu Maghrawa, the Banu Ifran and Banu Miknasa joined the Al Andalus forces landing at Tangier, soon receiving reinforcements commanded by the Almanzor's son, already chamberlain. At the beginning of August 998, Almanzor himself went to Algeciras with the numerous reinforcements destined to participate in the campaign. In October 998, Abd al-Malik managed to defeat Ibn Atiyya and put him to flight, although Almanzor still sought local support for the Umayyad administration. Until his death, however, the territorial government remained in the hands of successive Iberian officials.

The campaigns in the Maghreb also had an important consequence for Iberian politics: Almanzor brought Berber troops and warlords to the peninsula, both to form his personal troops and as contingents in the campaigns against Christian territories. Some of these leaders were even named viziers, which did not prevent their occasional fall from grace.

General characteristics
Since the death of Ramiro II of León in 950, his kingdom along with the kingdom of Pamplona and the county of Barcelona had been forced to recognize Cordoba's sovereignty through an annual tribute, with default resulting in reprisal campaigns. Almanzor began carrying these out in 977 and he continued to do so until his death in 1002, although most were concentrated in his later years when he was most powerful. In parallel with the Maghreb campaigns, Almanzor was devoted to the war against the Christian kingdoms of Iberia. Although the various sources are in conflict on the precise details, it is estimated that he made about fifty-six campaigns, twenty of these being in the first period from 977 to 985. In these offensives, Almanzor balanced attacks on centers of political and economic power with those against sites of religious importance. The famous raids, cavalry strikes and aceiphas, literally "summer campaigns" and called by the Christians cunei, had as their tactical and economic objective the taking of captives and cattle from the enemy; strategically they sought to generate a state of permanent insecurity that prevented Christians from developing an organized life outside of castles, fortified cities or their immediate vicinity. Their main feature was the short duration of the campaigns and the remoteness of the points reached by them. In spite of the military success of the many incursions, they failed to prevent in the long term ruin of the state. Although they halted the advance of Christian repopulation and dismantled important fortresses and cities, they failed to significantly alter the boundaries because Almanzor rarely occupied the territories he plundered.

The region most affected and vulnerable to the campaigns was the Douro valley. This was the destination for Christian settlers who were driven to repopulate it due to demographic pressure in Asturias, the heartland of the kingdom. This area was protected by the Cantabrian Mountains, a narrow strip of land that nonetheless could defend itself—unlike Leon or Galicia, which were more vulnerable to Moorish cavalry raids. In fact, Almanzor's campaigns reached all of Christian Spain with the exception of the Cantabrian coast, and contributed to León and Galicia coming more solidly under the sovereignty of the Asturian Crown, but still with great autonomy, due to the weakness of the kingdom's expansion.

First campaigns with Ghalib
The first eight campaigns were carried out with the support of his father-in-law Ghalib. Among them were three in the Salamanca lands (two in 977 and one in 978), another against Cuéllar (the same year), one against Pamplona and Barcelona (the long summer campaign of 978), one against Zamora (or maybe Ledesma, according to other authors, in the spring of 979) and one against Sepúlveda (in the summer of 979, which he could not take, although he razed its surroundings). The eighth was one in which he accompanied to Algeciras the forces destined to Maghreb, between September 979 and early 980.

The ninth campaign, in the spring of 980, was that during which the rupture between Almanzor and Ghalib took place and is known as "the one of betrayal" for Ghalib's surprise assault on Almanzor's son-in-law at Atienza. The confrontation followed a short raid through Castilla. The next four offensives (one in the fall of 980, two in the spring of the following year and one in the summer) took place during the conflict between the two rivals. During the last campaign – that of Almanzor's victory over Ghalib, he regained control of the fortresses of Atienza and Calatayud, held by partisans of his rival.

Weakening of León and harassment of the Castilian border
As a result of the defeat of Ghalib in the summer of 981, Almanzor's forces continued their advance, looting and destroying the lands around Zamora at the end of the summer. Later, they defeated Pamplona, León and Castile at the Battle of Rueda (or Roa) and recovered Simancas, which was razed. The loss of Simancas disrupted the Christian defensive line along the Duero, which later campaigns eventually dismantled. These losses, along with Almanzor's support for rivals to the Leonine crown, first Bermudo against the weakened Ramiro III and later rival counts, one of which briefly took the throne, plunged León into a political crisis that it submitted to Almanzor for arbitration. In general, Almanzor supported the noble families opposed to the monarch of the moment to take advantage of intra-Leonese squabbles. From 977, he launched attacks into León's territories almost annually.

The Galician and Portuguese counts, hostile to Ramiro III as they had been to his father, sought to appease Almanzor after the Trancoso and Viseu campaign of the beginning of the winter of 981 and for this they sought to impose a new king, Bermudo II, crowned in October 982 in Santiago while Almanzor pillaged the outskirts of León. Castile and León, continually exposed to Cordoban assaults, on the other hand, supported Ramiro. In 983, Almanzor plundered the area surrounding Salamanca in the fall, after failing to take it, and Sacramenia at the beginning of winter, slaughtering the men and taking the rest of the population captive. In his attempt to halt the Christian advance south of the Duero, he continued assailing the Leonese and Castilian positions in this area and the most important points of repopulation, such as Zamora (984) or Sepúlveda the same year, razed before he fell on Barcelona. The destruction of Sepúlveda forced Ramiro to submit to Córdoba in 985, the year of his death due to natural causes, as Bermudo had done before. Bermudo's submission had been accompanied by that of other Portuguese and Galician counts. This imposed the presence of Cordoban forces on the Leonese kingdom, as a protectorate, which it remained until 987.

The expulsion of the Cordoban troops from León by Bermudo triggered the 988 campaign against Coimbra and the torching of the Monastery of San Pedro de Eslonza in the first retaliatory campaign in 986, in which he also took León, Zamora, Salamanca and Alba de Tormes before attacking Condeixa.

Attacks on Pamplona and the Catalan counties
In 982, he launched the "campaign of the three nations' possibly against Castile, Pamplona and the Girona Franks, that forced the king of Pamplona, Sancho II to give to Almanzor a daughter, who would take the name Abda. This union would produce the last of Almanzor's political dynasty, Abd al-Rahman Sanchuelo. In 985, exploiting the subjugation of León and Castile, he attacked Barcelona, which he managed to take in early July, treating it harshly. Almanzor had previously attacked the region in the summer of 978, when for several months he ravaged the plains of Barcelona and parts of Tarragona, conquered by the Barcelona counts some decades earlier. In an almost three-month-long campaign, he captured the city with the help of the fleet, imprisoned Viscount Udalard I and Archdeacon Arnulf and sacked the monasteries of Sant Cugat del Vallés and Sant Pere de les Puelles.

New campaigns against León and Castile
In 987, he made two campaigns against Coimbra, conquering it during the second on 28 June. Unlike previous offensives, focused on looting and destruction, this time he repopulated the area with Muslims, who held the area until 1064. In 988 and 989, he again ravaged the Leonese Duero valley. He assaulted Zamora, Toro, León and Astorga, which controlled access to Galicia, and forced Bermudo to take refuge among the Galician counts.

After concentrating most of his attacks on León, he went on to launch his forces against Castile from 990, previously the object of only four of thirty-one campaigns. The west of León would, however, suffer one last attack in December 990, in which Montemor-o-Velho and Viseu, on the defensive line of the Mondego River, were surrendered, probably as punishment for the asylum that Bermudo had granted to the Umayyad "Piedra Seca". The failed collusion of his son Abd Allah and the governors of Toledo and Zaragoza triggered a change of objective. Fearing his father's anger over his participation in the plot along with the arrested governor of Zaragoza, Abd Allah had fled to take refuge with count García Fernández of Castile. As punishment and to force the surrender of his son, the chamberlain took and armed Osma in August. The broad raid achieved its goal and on 8 September, the Castilian count returned to Abdullah to his father in return for a two-year truce. Moving on from Castile, the following year he attacked the kingdom of Pamplona. Sancho II tried to appease the Cordoban leader with a visit to the capital of the Caliphate at the end of 992, but this failed to prevent his lands from being subject to a new foray in 994. The last half of the decade saw general submission of Pamplona to the Caliphate along with its repeated attempts to avoid any punitive Cordoban campaigns.

In 993 Almanzor attacked Castile again, for unknown reasons, but failed to take San Esteban de Gormaz, simply looting its surroundings. He succeeded in taking it the following year, along with Clunia. The loss of San Esteban dismantled Castilian defenses along the Douro, while the taking of Clunia endangered lands south of the Arlanza.

At the end of 994, on the occasion of the wedding between Bermudo II and a daughter of the Castilian count, Almanzor took León and Astorga, the Leonese capital since 988, and devastated the territory, perhaps also intending to facilitate a future campaign against Santiago de Compostela. In May 995, the Castilian Count Garcia Fernandez was wounded and taken prisoner in a skirmish near the Duero and, despite the care of his captors, he died in Medinaceli. He was succeeded by his prudent son Sancho, who had fought with Córdoba against his father and managed to maintain an informal truce with the Caliphate between 995 and 1000. The ties between Castile and the chamberlain were sealed with delivery of one of the new count's sisters to Almanzor as a wife or concubine. Urraca Sanchez, nicknamed "the Basque", adopted the Arabic name Abda after being given to Almanzor by her father Sancho II of Pamplona. Urraca and Almanzor had a single son, named Abd al-Rahman Sanchuelo that became chief minister of Hisham II, Caliph of Córdoba. As retribution for the support of the former count by the Banu Gómez, counts of Saldaña and former allies of Córdoba, their seat of Carrión was attacked in a raid that reached the monastery of San Román de Entrepeñas. At the end of 995, a new incursion against Aguiar, southeast of Porto, forced Bermudo II to return the former Umayyad conspirator "Piedra Seca."

Santiago de Compostela and his later campaigns
In 996, he again launched a raid on León and destroyed Astorga to force them to resume the tribute payments. In the summer of 997, he devastated Santiago de Compostela, after the Bishop, Pedro de Mezonzo, evacuated the city. In a combined operation involving his own land troops, those of Christian allies and the fleet, Almanzor's forces reached the city in mid-August. They burned the pre-Romanesque temple dedicated to the apostle James the Great, and said to contain his tomb. The prior removal of the saint's relics allowed the continuity of the Camino de Santiago, a pilgrimage route that had begun to attract pilgrims in the previous century. The campaign was a great triumph for the chamberlain at a delicate political moment, as it coincided with the breakdown of his long alliance with Subh. The Leonese setback was so great that it allowed Almanzor to settle a Muslim population in Zamora on his return from Santiago, while the bulk of the troops in Leonese territory remained in Toro. He then imposed peace terms on the Christian magnates that allowed him to forego campaigning in the north in 998, the first year this happened since 977.

In 999, he made his last foray to the eastern borderlands, where, after passing through Pamplona, he sacked Manresa and the plains of Bages. In April he attacked the County of Pallars, governed by the kin of the mother of count Sancho García of Castile. It is suggested that the attacks could have been triggered by the Pamplonan king and Catalan counts ceasing to pay tribute to Córdoba, taking advantage of Almanzor's distraction in crushing Ziri ibn Atiyya.

Also in 999, the death of Bermudo II in September produced a new minority in León through the ascent to the throne of Alfonso V, but this did not prevent the formation of a broad anti-Córdoba alliance that united not just the people of Pamplona and Castile, but also the ancient Christian clients of Almanzor. Sancho of Castile, until then a faithful ally who had managed to avoid the incursions of Córdoba into his territory, joined the alliance and provoked Almanzor into launching an attack. To his great surprise, the Castilian Count assembled a large force bringing together his own troops and those of his allies, who intercepted the Córdoban units north of Clunia in a strong defensive position. In the hard-fought battle of Cervera (29 July 1000), Almanzor's side gained the victory, after the rout of much of his army through the intervention of eight hundred cavalry.

After the victory, at the end of the year Almanzor made another strike at the western border, where he took Montemor-o-Velho on December 2, 1000, after overcoming fierce resistance. For its part, the kingdom of Pamplona suffered several attacks after the defeat of Cervera, in 1000 and again in 1001 and 1002. After Cervera, Almanzor accelerated the number of strikes, despite being sick and needing to be carried on a litter at times.

His last campaign, also victorious, was made in 1002, when he was mortally ill, having suffered from gouty arthritis for twenty years. He aimed to avenge the quasi-rout of Cervera and punish the Castilian count Sancho, architect of the alliance that almost defeated him. San Millán de la Cogolla, dedicated to the patron saint of Castile and in the territory of Pamplona, allied with Sancho, was sacked and burned; in Pamplona, Almanzor ordered a retreat due to his worsening health, and he died en route to Córdoba before reaching the capital.

The victorious campaigns of Almanzor were due to his skills as a military tactician and the army he commanded, which was a highly professionalized force of a size that dwarfed any counterattack that the Christian kings and counts could mount to meet him: "rarely above 1000 knights or 2000 or 3000 men in total." They had few weeks in spring or summer to gather what was often no more than a few hundred knights and men. "The most frequent average seems to have been a knight for every two or three auxiliary riders (squires and others) and one of these for every two or three peons." In those days an army of ten or fifteen thousand men – a third knights and the rest peons – was the maximum concentration of forces that a medieval ruler could muster when presenting battle. For example, Muslim campaigns had formations of only one thousand to ten thousand men. "An army of ten or fifteen thousand men is considered in every way exceptional and few historians would be willing to admit that on some occasion that number was actually reached by a host during a battle."

In his campaigns Almanzor emphasized cavalry operations, so much so that he had reserved the islands of the Guadalquivir for horse breeding. These marshes around Seville, Huelva and Cádiz had suitable pastures for raising horses. Mules were imported from the Balearic Islands and camels from Africa, the latter raised in the semi-desert area between Murcia and Lorca. According to Vallvé, "Normally participating in his campaigns were twelve thousand horsemen, enrolled in the military hierarchy and provided, in addition to that customarily due the usual soldier, with a horse with their harnesses, weapons, accommodation, payments and bonuses for various expenses, and fodder for their horses, based on their role."

Loot and slaves
Almanzor's campaigns were a continuation of a policy from emirate times: the capture of numerous contingents of Christian slaves, the famous esclavos or francos, in Arabic Saqtïliba or Saqáliba (plural of Siqlabi, "slave"). These were the most lucrative part of the loot, and constituted an excellent method of paying the troops, so much so that many campaigns were little more than slave raids. From these came many eunuchs who were essential elements for handling harems; others were purchased already castrated in Verdun and disembarked in Pechina or Almería according to Liutprand of Cremona. However, the most valuable take was the beautiful girls, selected according to "the predilection they had for the blonde and redhead Galicians, Basques and Franks," usually also described as having blue eyes, large breasts, wide hips, thick legs and perfect teeth that "the gynaecea of the royal families and the aristocracy supplied as concubines and legitimate wives." As in the case of the eunuchs, some slaves were bought from pirates attacking the Mediterranean coast, others came from Slavic or Germanic populations passing through several hands from Vikings, and there were also blacks imported from Sudan. Most of these slaves, however, were children who would be Islamized and assigned to work at court, including the work of eunuchs. Jews and, to a lesser extent, Muslims were involved in this lucrative trade, thanks to their ability as interpreters and ambassadors.

During the rule of Almanzor's Amirí regime, the already-rich Al-Andalus slave market reached unprecedented proportions. For example, the Moorish chronicles mention that after destroying Barcelona in July 985, Almanzor brought seventy thousand chained Christians to the great market of Córdoba and, after destroying Simancas in July 983, he captured seventeen thousand women and imprisoned ten thousand nobles. Obviously, these figures must be carefully evaluated, but likewise given the enormity this type of trade reached during his tenure, Almanzor is described as "the slave importer". The commoners of Córdoba even asked his successor to stop the trade since, to get a good husband for their daughters they had to raise the dowries to exorbitant levels because the young Christian slaves were so numerous and cheap that many men preferred to buy them instead of marrying Muslims.

Death and succession
Almanzor died on August 9, 1002 of illness at the age of about sixty-five in Medinaceli. During his last days, the dying chamberlain commended the government of the caliphate to his son, who hurried to Córdoba after his death to take his father's position and avoid any fickle opposition from the supporters of the family of the Caliph. The Historia silense says:

"But, at last, divine piety took pity on such ruin and allowed Christians to lift their heads because, in the thirteenth year of his kingdom, after many and horrible massacres of Christians, he was taken away in Medinaceli, a great city, by the devil, who had possessed him in life, and buried in hell."

His body was covered with the linen shroud that his daughters had woven with their own hands from raw material derived from the income of the estate inherited from their ancestors in Torrox, seat of their lineage. His remains were interred in the courtyard of the palace, covered by the dust his servants had shaken from their clothes after each battle against the Christians. According to the Arab historian Ibn Idari, the following verses were carved in marble as an epitaph:

"His exploits will teach you about him,

as if you saw it with your own eyes.

No one like him will ever given by God to the world again,

nor will anyone to defend the frontiers who compare with him."

The dynasty Almanzor founded continued with his son Abd al-Malik al-Muzaffar, and then his other son, Abd al-Rahman Sanchuelo, who was unable to preserve the inherited power, and was murdered in 1009. The fall of the Amiris set off the Fitna of al-Andalus, a civil war that resulted in the disintegration of the centralized Caliphate into regional taifa kingdoms.

Later, the legend of a defeat immediately prior to his death in a Battle of Calatañazor appeared first in the Estoria de España and was later adorned in other documents. Tradition holds that "in Calatañazor Almanzor lost the drum" (en Calatañazor Almanzor perdió el tambor) a term indicating that he there lost his joy because of the defeat that was inflicted.