The territories acquired by Austrian Empire (later the Austro-Hungarian Empire) during the First Partition included the Polish Duchy of Zator and Duchy of Oświęcim, as well as part of Lesser Poland with the counties of Kraków, Sandomierz and Galicia, less the city of Kraków. In the Third Partition, the annexed lands included Western Galicia and Southern Masovia. Major historical events of the Austrian Partition included: the formation of the Napoleonic Duchy of Warsaw in 1807, which was followed by the 1809 Polish–Austrian War aided by the French, and the victorious Battle of Raszyn resulting in Austrian temporary defeat (1809) marked by the recapture of Kraków and Lwów by the Duchy. However, the fall of Napoleon, leading to abolition of the Duchy at the Congress of Vienna (1815) allowed Austria to regain control. The "Congress" created the Free City of Kraków protectorate of Austria, Prussia and Russia, which lasted for a decade. It was abolished by Austria, after the crushing of Kraków Uprising in 1846. The formation of the Polish Legions by Piłsudski initially to fight alongside the Austro-Hungarian Army, helped Poland regain its sovereignty in aftermath of World War I.