Yulia Tymoshenko, the principal rival of Ukrainian President Viktor Yanukovych, has been convicted in a political trial in Ukraine of having exceeded her authority as prime minister in concluding a gas agreement with Russia in 2009 that was unfavorable to Ukrainian interests. For this she has been sentenced to seven years imprisonment and fined $200 million.

It is worth recalling the circumstances in which she had to negotiate.

The negotiations of 2008 came at the end of the second of two gas wars in three years between Russia and Ukraine, wars that led to Russian gas supplies being twice cut to Ukraine and Western Europe.

Russia’s gas sales to Ukraine have been repeatedly been used by Russia as an instrument for bringing Ukraine to heel.

When Russia first turned off the gas supply to Ukraine and Europe at the end of 2005, a year after the Orange Revolution, it was preceded by Russia tearing up a multi-year gas supply contract it had concluded in 2004 with the more pro-Russian government of President Leonid Kuchma and Prime Minister Viktor Yanukovych. Statements made Russians at the time make it clear that the main aims of the Russian action were political. One purpose was to create difficulties for Yushchenko and Prime Minister Tymoshenko in forthcoming parliamentary elections. Another was to take over the Ukrainian gas transit pipeline.

The EU had to intervene to put an end to that dispute.

In the gas war of 2008-2009, Russian motives were also not purely commercial. At the time Russia’s relations with Ukraine were especially tense because of Ukraine’s campaign to join NATO, its support for Georgia in its war with Russia, and Ukraine’s refusal to renew the lease on the Russian naval base on Sevastopol in the Crimea, which was to expire in 2017.

The Russians were also likely angry at the inability of the Ukrainians to pay a contested amount for past gas deliveries and the tough, dilatory and contradictory Ukrainian negotiating positions.

The Russians warned the Ukrainians that they would cut off the gas if the pricing issues were not solved by Dec. 31, 2008. On that day, the Russians proposed a gas price of $250 per 1,000 cubic meters. On the next day, Jan. 1, Yushchenko agreed to $250, but sought an increase in transit fees on Russian gas being shipped to Western Europe.

In response, Putin accused Yushchenko of breaking off negotiations, insisted on $450 and halted gas deliveries intended for Ukraine.

A few days later, Putin accused the Ukrainians of taking gas intended for Western Europe. In reprisal, he halted all shipments to Western Europe. He called for an international consortium to take over the Ukrainian transit system.

After the European Union observers had established that there was no evidence that Ukraine had cut shipments to Western Europe or siphoned off gas for its own use, Russia agreed to resume shipments to Western Europe, but only of a small amount, and that by a circuitous route that would have forced Ukraine to deprive much of the south of the country of gas.

It was apparently only after the intervention of German Chancellor Angela Merkel with Putin that he and Tymoshenko finally reached an agreement on gas and transit costs. The Western Europeans also put considerable pressure on both Russia and Ukraine to put an end to the gas war.

The new contract was based on the generally accepted formula used throughout Europe at the time that linked the price of gas to the price of diesel fuel plus transportation costs. Ukraine received a 20 percent discount on this price for 2009. Russia received a discounted price on transit fees for the same period. The agreement also did away with an intermediary the gas trade, RosUkrEnergo, which had been allegedly channeling funds to the party of Yanukovych as well as to associates of Yushchenko.

The facts therefore suggest that the gas agreement concluded by Tymoshenko was likely the best she could have achieved under the circumstances. The elimination of RosUkrEnergo, in addition, removed an apparent source of corruption.

Derek Fraser was Canada’s ambassador to Ukraine from 1998-2001. Fraser is a senior fellow for the Centre for Global Studies and an adjunct professor of political science at the University of Victoria.