The Emirate of Bari was a short-lived Arab state (emirate) ruled by non-Arabs centred on the south Italian city of Bari from 847 to 871. It was the most lasting episode in the history of Islam in peninsular southern Italy.
Bari first became the object of Arab or Berber raids in late 840 or early 841, when it was briefly occupied. According to Al-Baladhuri, Bari was conquered from the Byzantine Empire by Kalfün, a mirwah - perhaps a servant or escaped slave - of the Aghlabid Emir of Africa. Kalfün (Khalfun) was probably of Berber stock, possibly from the Emirate of Sicily originally. The conquest was seen by contemporary Muslims as unimportant, having been carried out by a minor figure without the support of any other Muslim state. Requests were sent, however, by Kalfün's successor, Mufarrag ibn Sallam, to the Abbasid caliph, al-Mutawakkil, in Baghdad, and his provincial governor of Egypt for recognition of the conquest with the title of wali, a governor ruling over a province of the Caliphate, which was granted. Mufarrag expanded Muslim influence and enlarged the territory of the emirate.
The third and last emir of Bari was Sawdan, who came to power around 857 after the murder of his predecessor Mufarrag. He invaded the lands of the Lombard Principality of Benevento, forcing Prince Adelchis to pay tribute. In 864 he finally obtained the official investiture requested initially by Mufarrag.
In 870 the Bariot Muslims stepped up their raids, going so far as to ravage the Gargano Peninsula including the Sanctuary of Monte Sant'Angelo. The Emperor Louis organised a response, fighting his way deep into Apulia and Calabria but bypassing major population centres like Bari or Taranto. A few towns were apparently freed of Muslim control and the various Muslim bands encountered were universally defeated. Probably encouraged by these successes, Louis attacked Bari with a ground force of Franks, Germans and Lombards and aided by a Croatian fleet (of Sclavini). In February 871 the citadel fell and Sawdan was captured and taken to Benevento in chains.