In the Byzantine Empire, the Duchy of the Pentapolis was a duchy (Latin: ducatus), a territory ruled by a duke (dux) appointed by and under the authority of the Praetorian Prefect of Italy (554–584) and then the Exarch of Ravenna (584–751). The Pentapolis (from the Greek term πεντάπολις, "five cities") consisted of the cities of Ancona, Fano, Pesaro, Rimini and Sinigaglia. It lay along the Adriatic coast between the rivers Marecchia and Misco immediately south of the core territory of the exarchate ruled directly by the exarch (the Ravennate), east of the Duchy of Perugia, another Byzantine territory, and north of the Duchy of Spoleto, which was part of the Lombard Kingdom of Italy (founded in 568). The duchy probably extended inland as far as the Apennine Mountains, perhaps beyond, and its southernmost town was Humana (Numera) on the northern bank of the Misco. The capital of the Pentapolis was Rimini and the duke was both the civil and military authority in the duchy.
The Pentapolis was one of the more commercially vibrant parts of Italy. The citizens of the Pentapolis tried constantly to reduce the authority of the exarch in the duchy, while Byzantine Italy generally experienced a general decentralisation during the 7th century. In 725, when the Exarch Paul wanted to lead a punitive expedition against the Duchy of Rome, where Pope Gregory II and the citizens had usurped imperial prerogatives and deposed and replaced the reigning duke, he raised troops in the Ravennate and the Pentapolis. The Lombard historian Paul the Deacon says that he had great difficulty in raising the necessary troops and his expedition was ultimately a failure. In 726, the iconoclasm of Emperor Leo III the Isaurian (r. 717–741) first became public, possibly even through an edict against sacred images. The inability of the exarch to impose his authority in Rome and his weakness in the Pentapolis was transformed into impotence when the "armies", that is, the Roman military aristocracies, of the duchies of the Ravennate, the Pentapolis, and Venetia rose in revolt declaring that they would protect the pope from the imperial decree, which Paul had been ordered to enforce throughout Italy (727).
In 738, the Lombard king Liutprand marched through the Pentapolis on his way to Spoleto, and during his transit was attacked by a group of "Spoletans" (Lombards from central Italy) and "Romans" (local Pentapolitans). The locals may have been incited to this alliance against Liutprand by the exarch, Eutychius, who may have had a deal with the duke of Spoleto, Transamund II. The Pentapolitans were not traditionally on good terms with either the Byzantines, whom Liutprand fought in 728–729, or the exarch in Ravenna, whom Liutprand also fought frequently, but they were unlikely to regard Lombard incursions in their region as a "liberation". Liutprand attacked Ravenna and Cesena on the via Aemilia in 743, probably with the goal of controlling a passage through Byzantine territory to Spoleto. His successor, Ratchis, attacked several cities in the Pentapolis and Perugia in 749, before retiring to become a monk. By 752, the Pentapolis was conquered by King Aistulf of the Lombards.
In 754 Pepin the Short crossed the Alps, defeated Aistulf, and gave to the pope the lands which Aistulf had torn from the ducatus Romanus (Duchy of Rome) and the exarchate (including the Pentapolis).