Ethnic settlement in East Prussia by the 14th century
At the instigation of Duke Konrad I of Masovia, the Teutonic Knights took possession of Prussia in the 13th century and created a monastic state to administer the conquered Old Prussians. Local Old-Prussian (north) and Polish (south) toponyms were gradually Germanised. The Knights' expansionist policies, including occupation of Polish Pomerania with Gdańsk/Danzig and western Lithuania, brought them into conflict with the Kingdom of Poland and embroiled them in several wars, culminating in the Polish-Lithuanian-Teutonic War, whereby the united armies of Poland and Lithuania, defeated the Teutonic Order at the Battle of Grunwald (Tannenberg) in 1410. Its defeat was formalised in the Second Treaty of Thorn in 1466 ending the Thirteen Years' War, and leaving the former Polish region Pomerania/Pomerelia under Polish control. Together with Warmia it formed the province of Royal Prussia. Eastern Prussia remained under the Knights, but as a fief of Poland. 1466 and 1525 arrangements by kings of Poland were not verified by the Holy Roman Empire as well as the previous gains of the Teutonic Knights were not verified.
The Teutonic Order lost eastern Prussia when Grand Master Albert of Brandenburg-Ansbach converted to Lutheranism and secularized the Prussian branch of the Teutonic Order in 1525. Albert established himself as the first duke of the Duchy of Prussia and a vassal of the Polish crown by the Prussian Homage. Walter von Cronberg, the next Grand Master, was enfeoffed with the title to Prussia after the Diet of Augsburg in 1530, but the Order never regained possession of the territory. In 1569 the Hohenzollern prince-electors of the Margraviate of Brandenburg became co-regents with Albert's son, the feeble-minded Albert Frederick.
The Administrator of Prussia, the grandmaster of the Teutonic Order Maximilian III, son of emperor Maximilian II died in 1618. When Maximilian died, Albert's line died out, and the Duchy of Prussia passed to the Electors of Brandenburg, forming Brandenburg-Prussia. Taking advantage of the Swedish invasion of Poland in 1655, and instead of fulfilling his vassal's duties towards the Polish Kingdom, by joining forces with the Swedes and subsequent treaties of Wehlau, Labiau, and Oliva, Elector and Duke Frederick William succeeded in revoking the king of Poland's sovereignty over the Duchy of Prussia in 1660. The absolutist elector also subdued the noble estates of Prussia.