From 1 January 1806, the territorial gains as a result of the German mediatization enlarged the electorate of Württemberg and it became a kingdom. In 1806, Prussia joined the coalition against Napoleon and was defeated and occupied within a few weeks. Napoleon wanted Württemberg to be bound to him closer by marriage. On 13 August 1807 Frederick William's sister, Catherine, married Napoleon's brother Jérôme, the king of the newly created Kingdom of Westphalia. In order to prevent Napoleon arranging a marriage for him, Frederick William sought permission from his father to marry Charlotte (later Caroline) Augusta, the daughter of the Bavarian king Maximilian I Joseph. After lengthy negotiations took place, the pair were married on 8 June 1808 in Munich. Since it was purely a marriage of convenience and Frederick William had no interest in a deeper relationship with his wife, Charlotte became increasingly lonely in Stuttgart. Frederick often stayed in Kassel at the court of his brother-in-law, Jérôme. Here he met Jérôme's former lover, Blanche La Flèche, Baroness of Keudelstein. He began an affair with her, which he later continued as king.
