As Russia had no full-fledged navy to intercept reinforcements coming to the Swedish garrison across the Baltic, Riga managed to hold out until October, when foreign officers commanding a small Russian flotilla defected to the other side and the Russians had to lift the siege. In the aftermath of this reverse, the Swedes recaptured much of Ingria, took the Pskov Monastery of the Caves and inflicted a heavy defeat on the Russian general Matvey Sheremetev at Walk (Valga) in 1657.

By the end of 1658, Denmark was knocked out of the Northern Wars and the Ukrainian Cossacks under Khmelnytskyi's successor, Ivan Vyhovsky, allied themselves with Poland, changing the international situation drastically and inducing the tsar to resume the war against Poland as soon as possible. Under such circumstances, it was necessary to bring the Swedish adventure to a speedy end. On 20 December Ordin-Nashchokin negotiated with Sweden the Treaty of Valiesar (Vallisaare), whereby Russia was allowed to keep the conquered territories in present-day Latvia and Estonia — Koknese, Aluksne, Dorpat, Nyslott — for three years.

When the term expired, Russia's military position in the Polish war had deteriorated to such a point that the tsar could not allow himself to be involved into a new conflict against powerful Sweden. His boyars had no other choice but to sign in 1661 the Treaty of Kardis (Kärde), which obliged Russia to yield its Livonian and Ingrian conquests to Sweden, confirming the provisions of the Treaty of Stolbovo. This settlement was observed until the Great Northern War broke out in 1700.