In 1454, the region was incorporated into the Kingdom of Poland by King Casimir IV Jagiellon. Following the Thirteen Years' War (1454–1466), it was part of Poland as a fief, initially held by the Teutonic Knights. From the 18th century it was part of the Kingdom of Prussia, and from 1871 to 1945 it was also part of Germany, before it became again part of Poland following Germany's defeat in World War II.