The County of Bar, from 1354 the Duchy of Bar, was a principality of the Holy Roman Empire encompassing the pays de Barrois and centred on the city of Bar-le-Duc. Part of the county, the so-called Barrois mouvant, became a fief of the Kingdom of France in 1301. The Barrois non-mouvant remained a part of the Empire. From 1480, it was united to the imperial Duchy of Lorraine. Both imperial Bar and Lorraine were ceded to France in 1738. With the death of the last duke, Stanislaus Leszczynski, in 1766, the duchy escheated to the French crown.
The county of Bar originated in the frontier fortress of Bar (from Latin barra, barrier) that Duke Frederick I of Upper Lorraine built on the bank of the river Ornain around 960. The fortress was originally directed at the counts of Champagne, who had made incursions into Frederick's allodial lands. Frederick also confiscated some lands from the nearby Abbey of Saint-Mihiel and settled his knights on it. The original Barrois was thus a mixture of the duke's allodial lands and confiscated church lands enfeoffed to knights. On the death of Duke Frederick III in 1033, these lands passed to his sister, Sophia (died 1093), who was the first person to associate the comital title with Bar, styling herself "Countess of Bar".
Sophia's descendants, of the House of Montbéliard, expanded Bar "by usurpation, conquest, purchase, and marriage" into a de facto autonomous state perched between France and Germany. Its population was francophone and culturally French, and the counts were involved in French politics. Count Reginald II (died 1170) married Agnes, a sister of the queen of France, Adele. His son, Henry I, died on the Third Crusade in 1190. From 1214 to 1291 Bar was ruled by Henry II and Theobald II, who secured the western frontier with Champagne by granting fiefs to French nobles and buying their homage.
In 1297 King Philip IV of France invaded the Barrois because Count Henry III had given aid to his father-in-law, Edward I of England, when the latter intervened against France in the Franco-Flemish War. In the Treaty of Bruges of 1301 Henry was forced to recognise all of his county west of the river Meuse as a fief of France. This was the origin of the Barrois mouvant: a territory that was turned into a fief was said to have "moved" and entered the mouvance of its suzerain. It was subject to the Parliament of Paris. The Treaty of Bruges did not represent any expansion of French territory. The territory to the west of the Meuse was French since the Treaty of Verdun of 843, but in 1301 it became a direct fief of the crown, including its allodial parts.
In 1354 the Count of Bar took the ducal title and was thereafter recognised as a Peer of France. Père Anselme (died 1694) believed that Count Robert had been created a duke by King John II of France in preparation for the count's marriage to John's daughter, Mary. The rulers of Bar were not created dukes by imperial appointment. The only title Count Robert received by imperial grant in 1354 was that of Margrave of Pont-à-Mousson. This margraviate was frequently bestowed by the Dukes of Bar on their heirs apparent. In that same year the emperor raised the County of Luxembourg into a duchy and Bar fell between two duchies, Luxembourg and Upper Lorraine. The ducal title was eventually accepted by the emperors, however, and the imperial tax register of 1532 records the "Duchy on the Meuse" (Herzogtum von der Maß) as a voting member of the Reichstag
In 1430 the last duke of the male line of the ruling house, Louis, died. Bar passed to his great-nephew, René I, who was married to Isabella, Duchess of Lorraine. In 1431 the couple inherited Lorraine. On René's death in 1480, Bar passed to his daughter Yolanda and her son, René II, who was already Duke of Lorraine. In 1482 he conquered the prévôté of Virton, a part of the Duchy of Luxembourg, and annexed it to Bar. In 1484 Peter II, Duke of Bourbon, regent for King Charles VIII of France, formally installed him in the Duchy of Bar. In his final testament published in 1506, René decreed that the two duchies of Bar and Lorraine should never be separated. The two duchies remained joined in personal union permanently.
On 2 October 1735 the preliminary Treaty of Vienna granted Bar to the deposed king of Poland, Stanislaus Leszczynski, immediately. He had to wait until the death of Grand Duke Gian Gastone of Tuscany on 9 July 1737 to receive Lorraine. In 1738, after the final Treaty of Vienna, he turned over the incomes from Bar and Lorraine to the French crown in exchange for a generous pension, which he used to fund construction projects in the duchies. On his death on 23 February 1766 the duchies passed to royal domain of France.
All the dates are regnal dates. All rulers before Sophia ruled Bar, but did not use the title "Count of Bar".