On Christmas Day 800, in Saint Peter's in Rome, Pope Leo III placed a crown on the king of the Franks and the assembled Romans acclaimed him emperor. Einhard, who knew him and wrote his life a decade or so after his death, reports that Charlemagne said afterwards he would not have entered the church that day had he known what the pope intended. Historians have argued about that remark ever since, because a ceremony of that scale is not improvised and because the claim of reluctance is exactly what a Frankish court would want on the record.
The difficulty was diplomatic before it was theological. There already was a Roman emperor, in Constantinople, and at that moment the throne was held by Irene, a woman, which western apologists used to argue the office was vacant. The eastern court did not accept the argument, and the matter was only settled in 812 when Byzantine envoys agreed to address Charlemagne as emperor without conceding that he was emperor of the Romans.
What the ceremony established in the West was more durable than the title. A pope had crowned an emperor, and the act could be read as a gift in the pope's hands. Later popes read it exactly that way, and later emperors read it as a formality confirming an authority they already held. The investiture disputes of the eleventh and twelfth centuries, and the political theology of the two swords, are arguments about what happened in that building on that morning.