Baden was a state in the southwest of Germany, primarily consisting of territory along the right bank of the Rhine opposite Alsace and the Palatinate. The territory came into existence as a margravate in the 11th century as a fairly small state. For most of the early modern period, the Baden lands were divided into two parts, one ruled by the Catholic Margraves of Baden-Baden, and the other by the Protestant Margraves of Baden-Durlach . In 1771, the Baden-Baden line became extinct, and all of the Baden lands came under the rule of Baden-Durlach. In the imperial reorganization of 1803, Baden gained a great deal of additional territory, and its rulers were made Electors of the Holy Roman Empire. This status lasted only for three years, until the end of the empire in 1806. In that year, the Margraves took on the title of Grand Duke of Baden, and gained additional territory. The Grand Duchy, within approximately the borders of 1806, continued to exist until the fall of the German monarchies in 1918, when it became a republic.