The Roman empire had not ceased to exist in 800. It was governed from Constantinople, and its throne was at that moment occupied by Irene, who had blinded and deposed her own son to take it. Western churchmen argued that a woman could not hold the imperial office and that the throne was therefore vacant, and it is in that gap that the events in Saint Peter's belong. During Mass on Christmas Day, Leo III crowned Charlemagne, king of the Franks and Lombards, and the congregation acclaimed him emperor of the Romans.
Einhard, Charlemagne's biographer, records that the king said afterwards he would not have entered the church that day had he known the pope's intention, a remark historians have read in opposite ways ever since: as genuine reluctance at receiving the crown from a bishop's hand, as unease at the diplomatic breach with Constantinople, or as a formula of modesty. Whatever he meant, the precedent set was that the pope crowns the emperor, and every medieval argument about whether the papacy therefore confers imperial authority begins here.
The consequences were not confined to the West. Constantinople regarded the coronation as usurpation and did not recognize a Western emperor for twelve years, and the two halves of Christendom, already drifting apart in language, liturgy and law, now had rival emperors as well as rival patriarchs. Leo himself had every reason to want a Frankish protector: in April 799 he had been ambushed in a Roman procession by nephews of the previous pope, who tried to blind him and cut out his tongue, and it was Charlemagne who sent him back to Rome under escort and came in person the following year to hear the charges against him.