The Peace of Thorn of 1466 reduced the Teutonic Knights, but brought no lasting solution to the problem they presented for Poland and their state avoided paying the prescribed tribute. The chronically difficult relations had gotten worse after the 1511 election of Albrecht as Grand Master of the Order. Faced with Albrecht's rearmament and hostile alliances, Poland waged a war in 1519; the war ended in 1521, when mediation by Charles V resulted in a truce. As a compromise move Albrecht, persuaded by Martin Luther, initiated a process of secularization of the Order and the establishment of a lay duchy of Prussia, as Poland's dependency, ruled by Albrecht and afterwards by his descendants. The terms of the proposed pact immediately improved Poland's Baltic region situation, and at that time also appeared to protect the country's long-term interests. The treaty was concluded in 1525 in Kraków; the remaining state of the Teutonic Knights (East Prussia centered on Königsberg) was converted into the Protestant (Lutheran) Duchy of Prussia under the King of Poland and the homage act of the new Prussian duke in Kraków followed.