MOSCOW- The biggest spy swap since the end of the Cold War was underway on Friday as Russia and the United States prepared to exchange 14 agents, defusing an espionage scandal that threatened improving relations. The dramatic conclusion to the espionage scandal which has gripped America came after spymasters brokered a deal for 10 Russian spies to be deported from the US, in return for four agents being released from jail in Russia. In the first step of the carefully choreographed swap, the 10 Russian agents pleaded guilty on Thursday in a New York court to charges against them and were immediately deported. Then, around midnight local time, Russian President Dmitry Medvedev signed a decree pardoning four spies serving jail terms in Russia on charges of spying for the West. Some of those accused in the US boarded a plane in New York on Thursday night and were expected to fly to Vienna, where people involved in the affair said they would be swapped for the four spies released from Russian jails. "The United States has agreed to transfer these individuals to the custody of the Russian Federation," the United States Justice Department said. "In exchange, the Russian Federation has agreed to release four individuals who are incarcerated in Russia for alleged contact with Western intelligence agencies," it said. The spy scandal broke at an awkward time for US-Russia ties, just days after Presidents Barack Obama and Dmitry Medvedev met for a friendly Washington summit last month. The US and Russian legislatures are also considering ratification of a key treaty cutting nuclear weapons, something neither side wants to jeopardise. Russia's Foreign Ministry said in a statement that the spy swap "gives reason to expect that the course agreed on by the leaders of Russia and the U.S. will be consistently implemented in practice and that attempts to knock the parties off this course will not succeed." But the swap itself -- which one Russian internet site quipped was "Russia 10: USA 4" - may add fuel to Republican accusations that President Barack Obama is being too soft on Moscow.