The Hafsid invasion of Ghadames took place between 1404 and 1405. It opposed the forces of the Hafsid caliph Abu Faris Abd al-Aziz II to those of the city of Ghadames.
The caliph Abu Faris Abd al-Aziz II, accompanied by Maliki scholars, marched to the fortified city of Ghadames with the goal of conquering it and spreading Malikism in Tripolitania. The city was looted and eventually surrendered to the caliph.
Caliph Abu Faris Abd al-Aziz II imposed an annual tribute on Ghadames. He was the first ruler to effectively enforce such a tribute on the city.