In 1558 the expansionist Russian Czar Ivan IV (Ivan the Terrible) invaded the independent region of Livonia (comprised of modern-day Estonia and parts of Latvia), in an effort to secure for Russia an outlet to the Baltic Sea.

Initially Ivan's invasion was successful, but he soon found himself fighting against an alliance of Poland and Sweden led by Polish King Stephen Báthory. Over time the protracted struggle began to be a drain on Ivan's resources, and with no end to the conflict in sight he was forced to accept unfavorable peace treaties (1582 and 1583) in which he renounced his territorial gains in Livonia and ceded additional Russian ports on the Gulf of Finland to Sweden.