Siege of Qal'at Bani Hammad

The siege of Qalaa of Beni Hammad (November 1015 – May 20, 1016) was conducted by the Zirid army of Emir Al-Mu'izz in modern-day province of M'sila, Algeria, during the Hammadid-Zirid War. The defenders of the Qala'a were under the command of the Hammadid Emir Hammad ibn Buluggin. The siege ended with the death of Badis ibn al-Mansur, resulting in a Hammadid victory and the Zirid army returning to Ifriqiya.

Background
When the two sides met at the Battle of Chelif, Badis led a surprise attack at Hammad's camp, resulting in his defeat. The latter fled with 500 cavalrymen, his army was set ablaze, and his supplies and wealth were plundered. Among the spoils were ten thousand adarga shields. The historian Hady Roger says that if the soldiers had not been preoccupied with looting, Hammad would have been captured. He fled without looking back until he reached forteresse of Maghila, and then to his own fortress Qal'at Bani Hammad, on the ninth of Jumada al-Awwal 406 AH / October 23, 1015 AD. He fortified himself there with his brother. They stayed there for three days, resting along with those who were with them.

Ibrahim anticipated that Badis would follow them and would lay a long siege, during which their food and salt supplies would run out. This is what Ibrahim expected, so he advised his brother Hammad to go out and gather as much food and salt as possible. They headed to the city of Dekama, located near Setif. Hammad, along with his brother Ibrahim and their soldiers, set out for the city of Dikama, two stages from M'Sila. Ibn Adhari mentioned that Hammad harbored resentment against the city's inhabitants while Badis was pursuing him. The inhabitants of the place encountered his rear guard. He confronted them with the sword and killed three hundred men. One of the city's qadi, named Ahmad ibn Abi Touba, came to Hammad and talked with him in a manner which angered Hammad, who, when he heard this, ordered the qadi execution. Also according to Ibn Adhari, another righteous man attempted to defend the people of Dekama but was executed as well.

Siege
Meanwhile, Badis continued his journey eastward. He arrived in Al-Muhammadiyah ( M'sila) on 28 Jumada al-Awwal 406 AH / November 13, 1015 AD. He was met by an envoy from his uncle Ibrahim, tasked with offering apologies on behalf of his brother Hammad, who admitted his mistake and reminded Badis of the services Hammad had rendered to the Zirid family, saying : "Did he not defend the western borders and protect the state, much like the renowned leader Al-Hajjaj ibn Yusuf supported the  Umayyads ?." Badis also received other letters containing apologies from Ibrahim and Hammad. It is likely that Badis avoided responding and imposed conditions his opponent found harsh, such as unconditional surrender.

Regardless, he left his army at the forteresse of Bani Hammad, which he surrounded on all sides, distributing money to the soldiers. He gave each soldier 500, 1000, or 2000 dinars. It is likely that these gifts were intended to entice the Hammadid soldiers to abandon their leader. It was said that this strategy embarrassed Hammad, causing a portion of his army to desert him. The siege of the fortress resulted in a shortage of supplies and rising prices. Finally, the death of Warro bin Sa'id and the resulting conflict between the supporters of Khalifa ibn Warro and Khazrun ibn Sa'id shattered Hammad's hopes for a Zenata victory in Ifriqiya that would force Badis to turn his attention to fighting them. Hammad deceived his men, producing fake documents claiming that Badis had decided to return to Ifriqiya. He also claimed to have received letters from the Emir calling for peace.The siege of the fortress lasted six months. Badis received reinforcements in the form of large numbers of Talkatas and Sanhajas, becoming confident in his ability to capture the fortress and reclaim the entire central Maghreb.

On Tuesday, the night before the last day of Dhu al-Qi'dah (29 Dhu al-Qi'dah 406 AH / May 9, 1016 AD), Badis ordered the army to be counted. Each commander took position with his troops, and the Zirid emir sat in his tent. He ordered Ayyub ibn Yatufat to inspect and count the soldiers, waiting until he had finished. When Ayyub reported back, Badis was pleased and returned to his palace. Later that evening, he, in great spirits and looking splendid, watched a display of skill before him. Each time he shook a spear, he broke it and took another. When he returned to his palace, he was filled with joy and happiness, eating and drinking with his close companions and relatives, who witnessed an unprecedented level of his exuberance. Around midnight on Wednesday, the last night of Dhu al-Qi'dah (May 10, 1016 AD), he passed away.He died due to a urinary retention and was less than 33 years old.

Aftermath
When Badis passed away, his servant immediately went to Habib ibn Abi Said, Badis ibn Abi Hamama, and Ayyub ibn Yatufet, who were the greatest of his commanders, and informed them of his death. There was enmity between Habib and Badis ibn Hamama, so Habib hurried to meet Badis, and Badis also went out to meet him. They met on the road, and each one said to the other: 'We know the animosity between us, but it is better that we agree to fix this problem now, and then we can return to our rivalry.' They then met with Ayyub and said: 'The enemy is near us and our leader is far from us. If we do not appoint a head to guide us in our matters, we will not be safe from the enemy. We also know that the Sanhaja tribe favors Al-Mu'izz, while others support Karama ibn al-Mansur, the brother of Badis.' They agreed to appoint Karama openly, and when they reached a secure place, they would appoint Al-Mu'izz ibn Badis, thus eliminating the conflict. They brought Karama, pledged allegiance to him, and appointed him immediately, without anyone in the army knowing. They planned to announce to the people in the morning that Badis had taken a medicinal drink." "But word of the  Emir’s death spread from the city of Al-Muhammadiyah (M'sila), the people there closed their gates, and climbed to their walls. What they could not hide became evident, as if it were announced publicly. The armies were disturbed and mingled with each other, fearing disunity. They decided to advance Karama. He took their pledges, and ordered letters to be sent to some territories. When the followers of Nasir al-Dawla and those who had joined him from various territories saw this, they disapproved and said: 'We only appointed him to protect the people and preserve the wealth until it is handed over to its rightful owner, Al-Mu'izz, the son of our master Nasir al-Dawla' They went secretly to each other at night, swore allegiance to Al-Mu'izz, and when they achieved their goal, they announced it on Saturday three days after Dhu al-Hijjah May 13, 1016 AD."

The armies allied with one faction after another, agreeing to send Karama to Achir to rally the tribes of Sanhaja and Talkata and bring them back to Al-Muhammadiyah. For this purpose, they handed over 100,000 dinars and a collection of weapons and supplies to him. He departed for Achir on Sunday, 4 Dhu al-Hijjah 406 AH / May 14, 1016 AD.On Saturday. Coinciding with the Eid al-Adha holiday 10 Dhu al-Hijjah 406 AH / May 20, 1016 AD, the armies left Al-Muhammadiyah after setting fire to the buildings and houses. The armies marched in a formation of vanguard, main body, and rear guard, with the coffin at the forefront, followed by drums, banners, and tents. Hammad then turned to Achir and took control of it in the presence of Karama. When news of Badis's death reached Al-Mahdiyah, Al-Mu'izz was pledged allegiance as Emir on either 21 or 23 Dhu al-Hijjah 406 AH / May 31 or June 2, 1016 AD.