From 1320/21 the former castellany served as the residence of the Piast duke Konrad I of Oleśnica; his son Duke Konrad II the Gray also inherited Koźle. The Duchy of Oleśnica, a Bohemian fief since 1329, was ruled from the town until the 1492 death of Duke Konrad X the White, last of the local Piasts. The duchy was sold to Duke Henry I of Münsterberg, son of the Bohemian (Czech) king George of Poděbrady. His grandson Duke John of Münsterberg-Oels established a gymnasium at Oleśnica in 1530. When the Czech Podiebrad family became extinct in 1647, town and duchy were inherited by the Swabian dukes of Württemberg, and in 1792 by the Welf dukes of Brunswick-Lüneburg. In the 17th century, the Polish-German language border ran close to Oleśnica, including the town to the territory dominated by the Polish language. Polish religious writers Adam Gdacjusz (nicknamed "Rey of Silesia") and Jerzy Bock published their works in Oleśnica. As a result of the First Silesian War the Duchy of Oels (Oleśnica) came under suzerainty of the Kingdom of Prussia in 1742. Following administrative reform in 1807 during the Napoleonic Wars, Oels became the seat of Landkreis Oels in the Province of Silesia, remaining capital of the Duchy of Oels (Oleśnica). In 1884 the duchy was incorporated into Prussia, itself part of Germany since the 1871 Prussian-led unification of Germany. After World War I, Oels was included within the Province of Lower Silesia. It was heavily damaged by the Red Army in 1945 during World War II, having approximately 60-80% of its buildings destroyed. The city was placed in Poland's borders after the Potsdam Conference and its official name became Oleśnica. The remaining German-speaking population was subsequently expelled and resettled with Poles many of whom were expelled from Eastern Poland annexed in 1945 by the Soviet Union. The majority of monuments in the Old Town have been rebuilt since the 1960s. Football club Pogoń Oleśnica is based in the town.