Foreign relations and diplomacy
Casimir sought to maintain influential relations with the Habsburgs and the Holy Roman Empire. In 1454, he married Elizabeth 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. Elisabeth's only brother Ladislaus, king of Bohemia and Hungary died in 1457, and after that, Casimir and Elizabeth's dynastic interests were directed also towards her brother's kingdoms.
The threat from the Ottoman Empire, which was expanding rapidly in the Balkans and along the Black Sea, loomed over Eastern Europe during Casimir's reign. While Poland-Lithuania did not engage directly in military conflict with the Turks, Casimir faced increasing pressure from the Ottomans' allies, including the Crimean Tatars, whose raids intensified. He was, nonetheless, able to maintain a semblance of stability on the eastern border, skillfully negotiating with the Muscovites and the Crimean Khanate to avoid full-scale war. His diplomacy helped prevent the dissolution of the Polish-Lithuanian alliance and ensured territorial integrity. In around 1480, Casimir was allied with the Great Horde against Muscovy and Crimea; however, his failure to support Khan Akhmed at the Great stand on the Ugra River contributed to Russia gaining its independence from the steppe nomads.
The intervention of the Roman curia, which hitherto had been hostile to Casimir, was due to the permutations of European politics. The pope was anxious to get rid of the Hussite King of Bohemia, George Podebrad, as the first step towards the formation of a league against the Ottoman Turks. Casimir was to be a leading factor in this combination, and he took advantage of it to procure the election of his son Vladislaus II as the King of Bohemia. But he would not commit himself too far, and his ulterior plans were frustrated by the rivalry of Matthias Corvinus, King of Hungary, who even went so far as to stimulate the Teutonic Order to rise against Casimir. The death of Matthias in 1490 was a great relief to Poland, and Casimir employed the two remaining years of his reign in consolidating his position still further.
In 1490, Casimir's son John Albert was elected the King of Hungary by a party among the Hungarian nobles. He was, however, defeated by his older brother, King Vladislaus II of Bohemia. Casimir, who wanted to secure a separate realm for his sons, proposed John Albert. Most Hungarian barons and prelates preferred Vladislaus because his rule in Bohemia had indicated that he would respect their liberties. Vladislaus was crowned King of Hungary on 18 September 1490 in Székesfehérvár.