Luxembourg remained more or less under French rule until the defeat of Napoleon in 1815. When the French had departed, a provisional administration by the Allies was installed. Luxembourg initially came under the Generalgouvernement Mittelrhein in mid-1814, then from June 1814 under the Generalgouvernement Nieder- und Mittelrhein (General Government Lower and Middle Rhine).
The Congress of Vienna of 1815 gave formal autonomy to Luxembourg. The Prussians had already in 1813 managed to wrest lands from Luxembourg, to strengthen the Prussian-possessed Duchy of Julich. The Bourbons of France held a strong claim to Luxembourg, the Emperor of Austria on the other hand had controlled the duchy until the revolutionary forces had joined it to the French republic (he reportedly was not enthusiastic about regaining Luxembourg and the Low Countries, being more interested in the Balkans).
The King of Prussia held the claim of the senior heiress, Anna. An additional claimant emerged, William I of the Netherlands who now ruled the Netherlands, and whose mother and wife were descendants of the Prussian royal family and thus also descendants of both daughters of the last Luxembourg heiress. Prussia and Orange-Nassau made the following exchange deal: Prussia received the Principality of Orange-Nassau, which included the ancestral lands of Nassau in Central Germany; the Prince of Orange in turn received Luxembourg.
Luxembourg, somewhat diminished in size (as the medieval lands had been slightly reduced by the French and Prussian heirs), was augmented in another way through the elevation to the status of grand duchy and placed under the rule of William I of the Netherlands. This was the first time that the duchy had a monarch who had no claim to inheritance of the medieval patrimony (as lineages through his mother and wife had a better entitled claimant, the Prussian king himself). However, Luxembourg's military value to Prussia prevented it from becoming a part of the Dutch kingdom. The fortress, ancestral seat of the medieval Luxembourgers, was taken over by Prussian forces, following Napoleon's defeat, and Luxembourg became a member of the German Confederation with Prussia responsible for its defense.