During the Teutonic rule, the region experienced a process of urbanization and economic boost due to the expansion of the Hanseatic League into the region. The Order later attacked their former ally Poland and conquered the region of Pomerelia, thus entered a long-lasting conflict with Poland, which subsequently entered an alliance with Lithuania. In Masuria, the Poles and Lithuanians defeated the Order at the Battle of Grunwald. The wars finally resulted in a rebellion of the urban population of Pomerelia and Warmia, who were affected by the Teuton's numerous wars; upon their request the region was incorporated to Poland by King Casimir IV Jagiellon, and after the Thirteen Years' War it remained under Polish suzerainty, but was divided into two parts: Elbląg and Warmia were incorporated directly into the Kingdom of Poland, Masuria became a Polish fief under the control of the Teutonic Order.