Lithuania, it was met with hostility, even to the point of military threats against Lithuania. Since the young Grand Duke was underage, the supreme control over the Grand Duchy of Lithuania was in the hands of the Lithuanian Council of Lords, presided by Jonas Goštautas. Casimir was taught Lithuanian language and the customs of Lithuania by appointed court officials. During Casimir's rule the rights of the Lithuanian nobility—dukes, magnates, and boyars (lesser nobles), irrespective of their religion and ethnicity—were put on an equal footing to those of the Polish szlachta. Additionally, Casimir promised to protect the Grand Duchy's borders and not to appoint persons from the Polish Kingdom to the offices of the Grand Duchy. He accepted that decisions on matters concerning the Grand Duchy would not be made without the Council of Lords' consent. He also granted the subject region of Samogitia the right to elect its own elder. Casimir was the first ruler of Lithuania baptized at birth, becoming the first native Roman Catholic Grand Duke. King of Poland In 1427, the Polish nobility initiated an anti-Jagiellonian opposition and attempted to have Władysław II Jagiełło's sons Władysław III and Casimir IV Jagiellon declared illegitimate to the Polish throne as they, being sons of a Lithuanian noblewoman Sophia of Halshany, had no blood link to the previous ruling Polish dynasty, the Piasts, however Casimir's father ensured the succession for his sons. Casimir succeeded his brother Władysław III (killed at the Battle of Varna in 1444) as King of Poland after a three-year interregnum on 25 June 1447. In 1454, he married Elisabeth of Austria, daughter of King Albert II of Germany and Elizabeth of Luxembourg, a descendant of King Casimir III of Poland. Her distant relative was Frederick III, Holy Roman Emperor. The marriage strengthened the ties between the house of Jagiellon and the sovereigns of Hungary-Bohemia and put Casimir at odds with the emperor through internal Habsburg rivalry. That same year, Casimir was approached by the Prussian Confederation for aid against the Teutonic Order, which he promised, by making the separatist Prussian regions a protectorate of the Polish Kingdom. However, when the insurgent cities rebelled against the Order, it resisted and the Thirteen Years' War (1454–1466) ensued. After a long and expensive war, Casimir and the Prussian Confederation defeated the Teutonic Order. In the Second Peace of Thorn (1466), the Order recognized Polish sovereignty over the seceded western