The order of precedence among European monarchies was a much-contested theme of European history, until it lost its salience following the Congress of Vienna in 1815.
Following the fall of the Western Roman Empire, many of the new polities acknowledged the lingering primacy of the (Eastern) Roman Empire, or were too isolated for matters of international relations to have much salience. In the late 8th century, the Frankish kingdom, which on Christmas Day 800 became the Carolingian Empire, unified all Christendom west of the Byzantine Empire, with few exceptions that were all geographically remote and could not contest its primacy (the Kingdom of Asturias, Brittany and the various kingdoms of the British Isles). The initial tension between the Carolingians and Byzantines over succession of the Roman Empire, dubbed by historians the problem of two emperors, largely faded away in the near-absence of a land border between the two entities. By contrast, the issue of precedence among Western European monarchies became a contentious issue following the disintegration of the Carolingian Empire which started in the 9th century.
The disputes about rank were initially concentrated between the two most immediate heirs of the Empire, namely the Holy Roman Emperor and King of France. In the 10th century, Carolingian kings of France sought Ottonian help against their Robertian rivals, thus placing themselves in an unequal relationship, as when Louis IV of France spent Easter in Aachen at the court of Otto I in 947, or when Lothair of France made peace with Emperor Otto II at Margut in 980. In the 11th century, by contrast, occasional meetings between the French king and the Emperor took place on a basis of equality of status, on or near the river Meuse that symbolized the border between the two realms: between Robert II of France and Emperor Henry II in 1006 and again (in Mouzon) in 1023; between Henry I of France and Emperor Conrad II in nearby Deville in 1033; and between Henry I of France and King then Emperor Henry III in Ivois, the base of the Lotharingian Counts of Chiny, in 1043, 1048 and 1056.
in the early 14th century, the French monarchy's legal officials formalized this equality by claiming that the king has in his kingdom the same prerogatives as the emperor in the Empire (Rex est imperator in regno suo). In 1377-1378, the visit to Paris of Emperor Charles IV and his son Wenceslaus, as recounted in the Grandes Chroniques de France, was strictly choreographied to highlight the emperor's equality of rank with his nephew King Charles V of France. The Grandes Chroniques specifically comment on the color of the horses used for the procession into Paris: since riding a white horse denoted sovereignty over the land, that attribute was reserved to the French king, while the Emperor rode a dark horse. Furthermore, the Emperor's horse was clothed with French colors.
Conflicts of precedence were intermittent and flared up especially at international meetings such as the Council of Constance in 1415 and Council of Basel in 1431.
Julius's ceremonial list may have temporarily resolved some squabbles, but did not satisfy those monarchs who felt entitled to a higher position than it granted them. The disputes were made visible by proceedings of the Papal court in Rome, where all the significant monarchies had ambassadors, and of occasional councils, as well as in third locations on occasion. The solution of acknowledging equality of all royal crowns as a matter of principle only emerged gradually, even though an early case was the mutual recognition of equal rank between France and England in the mid-16th century.
The Kings of France, who reigned over Europe's most populous country, were continuously frustrated by the primacy of the Emperors, but were never able to question it, even though they did object to the fact that the King of the Romans would similarly outrank them. The quest for higher status partly explains why the French kings sought the Imperial crown at the 1519 Imperial election and again at the 1658 Imperial election. As it happened, both attempts were unsuccessful.
Similarly, the monarchs of Spain were malcontent with the seniority of those of France, following the end of the reign of Charles V who had outranked his French counterpart as Holy Roman Emperor. The Council of Trent, which had started under Charles V, was the inevitable theater of the rivalry. In 1560, Philip II of Spain suggested a joint representation there of himself and his uncle Ferdinand I, Holy Roman Emperor, so that his envoy would outrank that of France. In 1562-1564 and again in 1583, Philip appears to have contemplated an imperial title over the Indies for similar reasons, but eventually gave up.
Spain contested French seniority for many generations: to avoid incidents, the respective ambassadors of the two countries often had to make sure they would not find themselves in the same place at the same time. In 1661, a contest for position between the French and Spanish ambassadors in a ceremonial procession in London led to a number of deaths. The issue was alleviated after the House of Bourbon secured the Spanish crown in the 18th century, and eventually settled with the Pacte de Famille of 1761.
Other conflicts of precedence lasted for most of the early modern era, notably between England and Spain; England and Portugal; Denmark and Sweden; Sweden and Poland; Poland and Hungary; Poland and Portugal. The generally held view that older monarchies deserved higher rank led to pseudo-historical claims of ancient origins, such as, for Sweden, Johannes Magnus's Historia de omnibus Gothorum Sueonumque regibus. The power politics of the day also played a role, for example when France accepted Sweden's claim of status equality at the Peace of Westphalia.
In addition, the emergence as European powers of the Ottoman Empire in the 15th and 16th century, and of the Tsardom of Russia in the 17th and 18th, created additional conflicts of precedence. After the fall of Constantinople in 1453, the Ottoman Sultans viewed themselves as rightful successors of the Roman Empire and would not concede superiority of rank to any European monarch. The European powers grudgingly accepted the Sultan's imperial rank above European kings (though not his claim of Roman succession), but were unwilling to countenance a higher position for the Sultan than that of the Holy Roman Emperor. In the Treaty of Constantinople (1533), at the height of Ottoman power, the European accepted the subterfuge of referring to Charles V only as King of Spain. At the Peace of Zsitvatorok (1606), the Ottomans for the first time acknowledged equal rank for the Holy Roman Emperor, in a manner reminiscent of the Carolingian and Holy Roman Empire's prior parity of status with the Byzantine Empire.
As for Russia, its monarch's title of Tsar was not viewed (outside of Russia itself) as denoting Imperial rank until the 18th century, after its victories in the Great Northern War transformed it into a fully-fledged European power. The Tsar's imperial dignity was recognized in 1721 by the Kingdom of Prussia and the Dutch Republic; 1723 by Sweden and Saxony; 1741 by the Ottoman Empire; 1742 by the Holy Roman Empire and Great Britain; 1745 by France and Spain; and 1764 by Poland.
In 1760 Sebastião José de Carvalho e Melo, 1st Marquis of Pombal, attempted to definitely resolve the issue of diplomatic precedence by denying any permanent seniority to envoys others than those of the Pope and Holy Roman Emperor. This was predictably rejected by the French minister in Lisbon. The formula eventually adopted at the Congress of Vienna would be similar.
The issue of precedence among ambassadors was settled at the Congress of Vienna, an outcome that was arguably enabled by the dissolution of the Holy Roman Empire in 1806 and the humbling of France following the Battle of Leipzig in 1813. A "Regulation concerning the precedence of Diplomatic Agents", inspired by Talleyrand, was signed on 19 March 1815 and included as the last (17th) annex in the Congress's Final Act. The rank of an ambassador was based on length of tenure, and specifically determined by the date of official notification of their arrival in a capital, except for papal envoys who retained senior status.
This convention remained in usage until 1961, when it was superseded by the Vienna Convention on Diplomatic Relations. The latter still allows the host state to grant seniority of precedence to the nuncio over others of ambassadorial rank accredited to the same country, and may grant the deanship of that country's diplomatic corps to the nuncio regardless of seniority.
The Congress of Vienna also considered settling the issue of precedence among monarchs themselves, but could not find consensus. Nowadays precedence in meetings of heads of state is defined by length of tenure.