Donation of Pepin
When the Exarchate of Ravenna finally fell to the Lombards in 751, the Duchy of Rome was completely cut off from the Byzantine Empire, of which it was theoretically still a part. Pope Stephen II acted to neutralize the Lombard threat by courting the de facto Frankish ruler, Pepin the Short. With the urging of Pope Zachary to depose the Merovingian figurehead Childeric III, Pepin was crowned in 751 by Saint Boniface.
Stephen later granted Pepin the title Patrician of the Romans. Pepin led a Frankish army into Italy in 754 and 756. Pepin defeated the Lombards – taking control of northern Italy – and made a gift (called the Donation of Pepin) of the properties formerly constituting the Exarchate of Ravenna to the Pope.
In 781, Charlemagne codified the regions over which the Pope would be temporal sovereign: the Duchy of Rome was key, but the territory was expanded to include Ravenna, the Pentapolis, parts of the Duchy of Benevento, Tuscany, Corsica, Lombardy and a number of Italian cities. The cooperation between the Papacy and the Carolingian dynasty climaxed in 800, when Pope Leo III crowned Charlemagne the first "Emperor of the Romans" ('Augustus Romanorum').
Read more about this topic: Papal States