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, while 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 associatee the comital title with Bar, styling herself "Countess of Bar".