A Polish–Lithuanian union and military alliance had come about as a mutual response to a common threat posed by the Teutonic Order and the Golden Horde and its successor states, including Muscovy. The alliance was first established in 1385 by the Union of Krewa,[20] solemnized by the marriage of Poland's Queen Jadwiga and Lithuania's Grand Duke Jogaila, of the Gediminid dynasty, who became King Władysław II Jagiełło of Poland.