I'm trying to find more information about this emirate but all i can find is the short description of wikipedia and a lot of ck2 related posts. I'm really interested in the muslim impact in italian (and european in general) history but other than the Emirate of Sicily i cant find much.
I'm no historian but I'm from Bari, the few sources on this topic are in Italian so I can probably sum it up for you. This piece of history is very niche, apart from academics basically no one in Bari knows about this very interesting albeit short period of time, which was so short its impact on italian history as a whole is basically nonexistent. The city was Taken by Khalfun, a berber commander in 847AD overnight; they rose to the occasion as the city was walled, on the sea: easily defendable, and they made the conscious choice to establish a base on mainland Italy from which they could go on and pillage neighbouring villages. In 852 Mufarrag took the place of Khalfun, a mosque and a market were built (unfortunately there's no trace of them today); he started asking to the african caliph to be recognized as a wali, ergo an autonomous emirate, being berbers they weren't fond of the Saracens in Sicily and wanted to cut ties with them. Mufarrag was said to be balanced and prudent and this led to his demise: he was killed and replace by the first and last real wali of the now officially recognized emirate: Sawdàn. He was described by latins as ruthless and violent ( for obvious reasons, which I stated above), although the jewish populace of the city described us another Sawdàn, diplomatic and with a thirst for knowledge: it's very likely he was both.
Basically the end of the Berber domination in Bari ( and Southern Italy as a whole during the next century), was a joint operation by Byzantines, Longobards and the ducate of Benevento: these were the biggest players in southern Italy and basically tolerated the berbers raid on villages and used them as a mean of hurting one another until the berbers grew in their ambitions and started attacking and pillaging Benevento; Ludovico II tried to conquer the city twice: on one occasion he could not enter and retreated; the second time, in 872, after conquering another berber outpost, Matera, he managed to take Bari, slaughtering the muslim populace but sparing the wali.
Today all that remains is the cap du turche ( head of the turk in Bari dialect) : the story goes that Mufarrag was beheaded by a witch, wich he chose to challenge on the streets in the night instead of staying home: his head went tumbling under that wall where it is found today