UKRAINIAN PRESIDENT Viktor Yanu­kovych has pursued a policy of balancing relations with East and West, seeking closer ties with the European Union and United States while cooperating more readily than his predecessors with Vladi­mir Putin’s Russia. So it was a measure of Mr. Yanukovych’s malfeasance that Washington, Moscow and Brussels all publicly lambasted his government this week.

What drew their attention was the sentencing of the president’s chief political rival, Yulia Tymoshenko, to seven years in prison. A former prime minister, Ms. Tymoshenko was accused of administrative missteps when negotiating a deal for the purchase of Russian gas. But if foolish decisions are to be criminalized in Ukraine, Mr. Yanukovych himself would be a prime suspect.

A former truck driver whose attempt to steal a 2004 presidential election prompted Ukraine’s Orange Revolution, Mr. Yanukovych has pursued two contradictory objectives since gaining the presidency in a fair 2010 vote. He has made integration with the European Union a major objective, negotiating an association agreement that would grant Ukraine free trade privileges. He has courted the Obama administration by striking a deal to dispose of highly enriched uranium. While making some important concessions to Russia, Mr. Yanukovych so far has resisted Mr. Putin’s attempts to draw Ukraine into a customs union with other former pieces of the Soviet Union.

Yet Mr. Yanukovych has simultaneously attempted to consolidate power in Putinesque fashion — a campaign entirely at odds with Western integration. In addition to the prosecution of Ms. Tymoshenko and a number of other opposition figures, Mr. Yanukovych has benefited from a dubious court ruling granting him additional powers and presided over local elections that independent observers called unfair. Despite repeated and explicit warnings that the jailing of Ms. Tymoshenko would endanger the E.U. deal, which is due to be completed in the coming weeks, the trial went forward. Some Ukrainians suspect that Mr. Yanukovych may have believed that, like Mr. Putin, he would be given a pass on his autocratic moves by Western governments eager to make deals.

The chorus of condemnations — joined even by Mr. Putin, who objected to having the gas deal he struck with Ms. Tymoshenko portrayed as criminal — may have served to sober the Ukrainian leader. On Thursday Mr. Yanukovych said he supports action by parliament to decriminalize actions such as that taken by Ms. Tymoshenko. This could allow an appeals court to free her before the end of the month, which in turn could allow the E.U. association agreement to move forward. That would be an acceptable outcome, but European leaders should resist the temptation to pursue the trade pact as long as the opposition leader remains in prison. The fact that prosecutors brought new charges against Ms. Tymoshenko even as Mr. Yanukovych was hinting at his concession only underlines that point. No one wants to drive Ukraine, a country of 50 million, back under the dominion of Russia. But as they demonstrated in 2004, Ukrainians themselves are unwilling to accept that outcome.