Louis II's campaign against Bari (866–871)

The Frankish emperor Louis II campaigned against the Emirate of Bari continuously from 866 until 871. Louis was allied with the Lombard principalities of southern Italy from the start, but an attempt at joint action with the Byzantine Empire failed in 869. In the final siege of the city of Bari in 871, Louis was assisted by a Slavic fleet from across the Adriatic.

The city fell and the emir was taken captive, bringing the emirate to an end, but a Saracen presence remained at Taranto. Louis himself was betrayed by his Lombard allies six months after his victory and had to leave southern Italy.

Military actions of 866–867
Louis II was sent by his father, Lothair I, to southern Italy to counteract Saracen raids in 848–849. He launched an unsuccessful attack on Bari in 852, and again in 855 and 857. In 865, he began planning a campaign to completely oust the Saracens from southern Italy. In that year he issued a capitulary in northern Italy summoning an army to gather at Lucera in the spring of 866. The capitulary calls for more than an offensive action, it also ordered the construction of castles (castella) with palisades, outworks, moats and ramparts. These were places for the people to take refuge and it was probably hoped that they would deter raids.

No source describes the campaign, if any, that the army that gathered at Lucera undertook. In June 866, Louis II deposed the bishop and count of Capua, Landulf II, and imposed his own representative on the city, Duke Lambert I of Spoleto. This probably required the use of the army, but for the next six months Louis peacefully toured the Lombard principalities of the Campania, assuring himself of their loyalty prior to his next move against Bari. According to Erchempert, a contemporary witness, the princes of Benevento, Salerno and Capua all urged the emperor to attack Bari.

Louis spent the winter of 866–867 in Benevento. Marching from there in the spring, he captured Matera and Oria, towns that lay between Bari and Taranto. Matera he razed, and he may have cut off or severely impeded communication between Bari and Taranto. The different treatment of Oria and Matera may be due to the strategic position of Matera, requiring that it be denied to the enemy in the future, or perhaps to the assistance of the inhabitants of Oria, which is implied by the 11th-century chronicler Ahimaaz ben Paltiel to have suffered a decline under Saracen rule. Louis also established a garrison in Canosa, a town on the Lombard–Saracen frontier. It is unlikely that Louis used the army summoned for 866 in this campaign, since the capitulary had specified only one year of service.

Failed joint attack of 869
In March 868, Louis was at Benevento. According to the Chronicle of Salerno, written about a century later, he sought naval assistance from the new Byzantine emperor, Basil I. As part of these negotiations, a marriage may have been proposed between Louis's daughter, Ermengard, and Basil's eldest son, Constantine. According to a later Byzantine source, On Administering the Empire, it was Basil who first contacted Louis. He had a claim to the city of Bari and also a strategic interest in the defeat of the emirate, which menaced Byzantine Dalmatia on the other side of the Adriatic Sea. A joint attack on Bari seems to have been set for late in the summer of 869.

Louis was in Benevento, preparing for the attack, in June 869. According to a northern source, the Annals of Saint-Bertin, a Byzantine fleet of 400 ships arrived off Bari later in the year. Other sources put the number of ships much lower. This was probably the fleet that had just relieved the Saracen siege of Ragusa (867), which was possibly the same fleet that also relieved Saracen pressure on Syracuse (868). The Byzantine commander, Niketas Ooryphas, expected to take custody of Louis's daughter, and sailed away when this was refused. In a subsequent letter to Basil I, Louis II accuses Niketas of arrogant and insulting behaviour. The exact cause of the failed joint action of 869 is unknown, but probably involved misunderstandings on both sides. According to Niketas, he had found Louis's army small, ill-disciplined and in no condition to fight. Louis argued in his letter that he had in fact already disbanded his main force for the winter because Niketas' fleet arrived so late in the year.

Successful siege of 870–871
In 869, according to the Annals of Saint-Bertin, after the departure of the Byzantine fleet, the emir of Bari sent raiders into the Gargano. The shrine of Saint Michael the Archangel was plundered. In response, in 870 Louis raided deep into Apulia. Several towns were taken. Following this successful raid, Louis invested Bari itself, with an army containing both Franks and Lombards. He had naval assistance, certainly a Croatian fleet and possibly a Byzantine one. The Chronicle of Salerno mentions neither, while On Administering the Empire mentions a Byzantine fleet. There is no other evidence for Byzantine involvement in the campaign of 870–871. Two Byzantine sources, On Administering the Empire and the Life of Basil the Emperor, refer to a Slavic contingent brought to the siege by the fleet of Ragusa.

According to Andrew of Bergamo, the people of Calabria sent envoys to Louis during the siege, offering allegiance and tribute in exchange for protection from the Saracens. Louis sent a detachment to Calabria, where it defeated a Saracen army near Amantea. This provoked a reaction from Aghlabid Sicily. Sicilian Muslim reinforcements were dispatched to Bari, but Louis intercepted and defeated them. The city surrendered in February 871. Emir Sawdān was led back as a captive to Benevento. Louis immediately began preparations to besiege Taranto. He placed a Lombard gastald in charge of Bari.

Aftermath
Louis II's letter to Basil I was composed between February and August 871, probably with the help of Anastasius Bibliothecarius. It is chiefly concerned with defending Louis's use of the title "emperor of the Romans", since a dispute over this title may have played a role in the failure of Franco-Byzantine cooperation in 869. Louis also mentions the arrival of enemy reinforcements from Sicily and Africa, apparently responding to the threat to Taranto, and he accuses Duke Sergius II of Naples of conspiring with the Aghlabids. These troops did not move to retake Bari, however, but besieged Salerno in an effort to strengthen their position in Calabria and parts of the Italian peninsula nearer to Sicily.

The conflict between Louis II and Sawdān did not end with the fall of Bari and the latter's captivity. All the sources present the captive emir as being popular in Benevento and receiving many visitors. Louis's continued presence in Benevento became an irritation to the Lombards, however, and on 13 August 871 he, his wife Engelberga and his daughter Ermengard were arrested by Prince Adelchis. According to the Chronicle of Salerno, the prince had consulted Sawdān on his plan beforehand. The Annals of Saint-Bertin record that Louis had been planning to send Adelchis into exile, and On Administering the Empire adds that this was a rumour spread by Sawdān. A contemporary poem, On the Captivity of the Emperor Louis, calls the imprisoned emir a "cunning assailant [or instigator]" (kalidus ille temtator).

The arrest appears to have been accompanied by some violence. Rumours of Louis's death spread north of the Alps. His uncle, Charles the Bald, set out to claim Italy before he learned of the falsity of the rumours. Louis and his family were freed on 17 September through the intervention of the bishop of Benevento. The only condition was that he swear an oath never to return to Benevento. Sawdān remained a prisoner of the Beneventans until Louis's death in 875, when he was freed and joined the Saracens of Taranto. According to the contemporary chronicler John the Deacon, Duke Sergius II of Naples and Prince Guaifer of Salerno had connived with Adelchis in Louis's imprisonment. Rumours of Byzantine involvement, however, seem to have been false. Duke Lambert of Spoleto had also joined the conspiracy. Louis had him deposed and installed Suppo as duke in his stead.

Following Louis's death, the Byzantines occupied Bari, establishing the theme of Longobardia.