Muhammad II of Ifriqiya

Gold dinar of Muhammad II

Abu 'l-Gharaniq Muhammad II ibn Ahmad (Arabic: أبو الغرانيق محمد الثاني بن أحمد‎) (died 875) was the eighth Emir of the Aghlabids in Ifriqiya (864–875).

He succeeded his uncle Ziyadat Allah II (863–864), inheriting from his predecessors a stable and prosperous state. An aesthete fond of wine and hunting, he felt able to devote himself to extravagance and displays of pomp. His reign saw the conquest of Malta and raids into mainland Italy were sufficient to force tribute from Pope John VIII.

Towards the end of his reign a caravan of pilgrims from Mecca introduced the plague into Ifriqiya - this, and an ensuing famine led to severe depopulation and the weakening of the kingdom.

He was succeeded by his brother Abu Ishaq Ibrahim II (875–902).