Since the descendants of
Charles Frederick's first marriage to
Karoline Louise of Hesse-Darmstadt were at first plentiful, no one expected the Hochberg children of his second wife to be anything except a family of counts with blood ties to the grand ducal family, but lacking dynastic rights. Count Leopold von Hochberg was born in
Karlsruhe, and with no prospects of advancement in
Baden, followed a career as an officer in the French army. The situation of both the grand duchy and the Hochberg children became objects of international interest as it became apparent that the Baden male line descended from Karl Frederick's first wife was likely to die out. One by one, the males of the House of Baden expired without leaving male descendants. By 1817, there were only two males left, the reigning
Grand Duke Charles I, a grandson of Charles Frederick's, and his childless uncle
Prince Louis. Both of Charles's sons died in infancy. Baden's dynasty seemed to face extinction, casting the country's future in doubt. Unbeknownst to those outside of the court at Baden, upon the 24 November 1787 wedding of then-Margrave Charles Frederick to Luise Karoline Geyer von Geyersberg, he and the three sons of his first marriage signed a declaration which reserved decision on the title and any succession rights of sons to be born of the marriage. Although Luise Karoline's children were not initially legally recognised as of
dynastic rank, on 20 February 1796 their father clarified in writing (subsequently co-signed by his elder sons) that the couple's sons were eligible to succeed to the margravial throne in order of male
primogeniture after extinction of the male issue of his first marriage. The Margrave further declared that his marriage to their mother must "in no way be seen as morganatic, but rather as a true equal marriage". On 10 September 1806, after the abolition of the Holy Roman Empire and the assumption of full sovereignty, Charles Frederick confirmed the dynastic status of the sons of his second marriage. This act was, yet again, signed by his three eldest sons, but was not
promulgated. On 4 October 1817, as neither Grand Duke Charles nor the other sons from his grandfather's first marriage had surviving male descendants, Charles proceeded to confirm the succession rights of his hither-to morganatic half-uncles, elevating each to the title Prince and Margrave of Baden, and the style of
Highness. He asked the princely congress in
Aachen on 20 November 1818, just weeks before his death, to confirm the succession rights of these sons of his step-grandmother, still known as Countess Luise von Hochberg. But this proclamation of Baden's succession evoked international challenges. The
Congress of Vienna had, in 1815, recognised the claims of Bavaria and Austria to parts of Baden which it allocated to Charles Frederick in the
Upper Palatinate and the
Breisgau, anticipating that upon his imminent demise those lands would cease to be part of the Grand Duchy. Moreover, the
Wittelsbach king of Bavaria,
Maximilian I Joseph, was married to Grand Duke Charles's eldest sister,
Caroline of Baden. The female most closely related to the last male of a German dynasty often inherited in such circumstances, in accordance with
Semi-Salic succession law. As a result, Maximilian had a strong claim to Baden under the customary rules of inheritance, as well as his claims under a post–
Congress of Vienna treaty of 16 April 1816. Nonetheless, in 1818 Charles granted
a constitution to the nation, the liberality of which made it popular with the people of Baden and which included a clause securing the succession rights of the offspring of Luise Karoline Geyer von Geyersberg. Another dispute was resolved by Baden's agreement to cede a portion of the county of
Wertheim, already
enclaved within Bavaria, to that kingdom. To further improve the status of Prince Leopold, his half-brother the new
Grand Duke Louis I arranged for him to marry his great-niece,
Sophie, daughter of former King
Gustav IV Adolf of Sweden by Grand Duke Charles's sister,
Frederica. Since Sophie was a granddaughter of Leopold's oldest half-brother,
Charles Louis, this marriage united the descendants of his father's (Grand Duke Charles Frederick's) two wives. Sophie's undoubted royal blood would help to offset the stigma of Leopold's morganatic birth. Finally, on 10 July 1819, a few months after Charles's death, the
Great Powers of Austria, France, Great Britain,
Prussia and Russia joined with Bavaria and Baden in the 1819
Treaty of Frankfurt which recognized the succession rights of the former Hochberg morganatic line. When Louis I died on 30 March 1830, he was the last male of the House of Baden not descended from the morganatic marriage of Charles Frederick and Luise Karoline Geyer von Geyersberg. Leopold von Hochberg now succeeded as the fourth Grand Duke of Baden. ==Reign==