 On 15 March 1806 he ceded the Duchy of Berg to Napoleon.Shortly thereafter, the Confederation of the Rhine was formed and Maximilian, with the other princes who joined that body, announced his secession from the Holy Roman Empire.The King still served as an Elector until Bavaria left the Holy Roman Empire (1 August 1806).