Soon after his accession, the territory ruled by the popes was invaded by Desiderius, king of the Lombards, and Adrian found it necessary to invoke the aid of the Frankish king Charlemagne, who entered Italy with a large army, besieged Desiderius in his capital of Pavia, took that town, banished the Lombard king to Corbie in France and, in an innovative gesture, took the title 'King of the Lombards' himself. The pope, whose expectations had been aroused, had to content himself with some additions to the duchy of Rome, and to the Exarchate of Ravenna, and the Pentapolis in the Marches, which consisted of the "five cities" on the Adriatic coast from Rimini to Ancona with the coastal plain as far as the mountains.
A mark of such newly settled conditions in the Duchy of Rome is the Domusculta Capracorum, the central villa on the Roman plan that Adrian assembled from a nucleus of his inherited estates and acquisitions from neighbors in the countryside north of Veii. The villa is documented in Liber Pontificalis but its site was not rediscovered until the 1960s, when excavations revealed the structures on a gently rounded hill that was only marginally capable of self-defense but fully self-sufficient, with its own grain mill, smithies and tile-kilns, for a mixed economy of grains and vineyards, olives, vegetable gardens and piggery. In the tenth century, villages were carved out of Adrian's Capracorum estate: Campagnano mentioned first in 1076, Formello mentioned in 1027, Mazzano in 945, and Stabia (modern Faleria) in 998.
In his contest with the Byzantine Empire and the Lombard dukes of Benevento, Adrian remained faithful to the Frankish alliance, and the friendly relations between pope and king were not disturbed by the difference which arose between them on the question of the veneration of images, to which Charlemagne and the bishops in France were strongly opposed, while Adrian favoured the views of the Eastern Church, and approved the decree of the second council of Nicaea (787), confirming the practice and excommunicating the iconoclasts. It was in connection with this controversy that the Libri Carolini were written, to which Adrian replied by letter, anathematizing all who refused to venerate the images of Jesus, or the Virgin Mary, or saints. Notwithstanding this, a synod, held at Frankfurt in 794, anew condemned the practice, and the dispute remained unsettled at Adrian's death.
In 787, he elevated the diocese of Lichfield, in England, to an archdiocese on request from the English bishops and King Offa of Mercia in order to balance the ecclesiastic power in that land between Kent and Mercia. He gave the Lichfield bishop Higbert the pallium in 788.
An epitaph written by Charlemagne in verse, in which he styles Adrian "father," is still to be seen at the door of the Vatican basilica. Adrian restored some of the ancient aqueducts of Rome, and rebuilt the churches of Santa Maria in Cosmedin, decorated by Greek monks fleeing from the iconoclastal persecutions, and of San Marco in Rome. At the time of his death, his was the longest papacy since Saint Peter, and it would remain so until he was surpassed by the 24-year papacy of Pius VI in the late 18th century. In fact, only three more popes (Pius IX, John Paul II and Leo XIII) have reigned longer since.