Hafsid dynasty
The Hafsid dynasty had since 1227 ruled Tunisia, enjoying prestige when it was the leading state of the Maghrib, or barely surviving in ill-favored times. Extensive trade with European merchants continued over some centuries, an activity which led to state treaties. Yet the Hafsids also harbored corsairs who raided merchant shipping. During the 15th century the Hafsids employed as bodyguards a Christian force of hundreds, nearly all Catalans. In the 16th century the Hafsid rule grew weak, limited often to Tunis; the last three Hafsid sultans al-Hasan, his son Ahmad, and his brother Muhammad made inconsistent treaties with Spain.