Ukrainian President Victor Yanukovych has a problem. He wants to bring his country closer to Europe, the next steps being conclusion of an association agreement and comprehensive free trade arrangement with the European Union. But the arrest and trial this summer of opposition leader Yuliya Tymoshenko pose a huge stumbling block. The Ukrainian president may now be coming to realize the size of the problem.

Following his 2010 election—in which he narrowly defeated Tymoshenko—Yanukovych pursued a foreign policy aimed at improving Ukraine’s frayed relations with Moscow while at the same time drawing closer to Europe, particularly the European Union. He has increasingly this year placed weight on the Europe vector, for example, eschewing Russian entreaties to join a customs union with Russia, Belarus and Kazakhstan in favor of a free trade arrangement with the European Union.

Part of the growing pro-Europe emphasis stems from disappointment with Moscow’s response to Kyiv’s early efforts to assuage Russian concerns: Ukraine dropped its goal of membership in NATO; extended the Russian Black Sea Fleet presence in Crimea by 25 years; and stopped pursuing steps that irritated the Kremlin leadership, such as seeking to have the holodomor (the 1930s famine) recognized as genocide.

Moscow agreed to cut the price of the natural gas that it sold to Ukraine but, in Kyiv’s view, has done little else. The Russians have brushed aside Ukrainian pleas to reopen the broader gas contract; continued to pursue pipelines to move gas around rather than through Ukraine; and leaned heavily on Kyiv for greater access for Russian companies to buy up Ukrainian energy infrastructure and other assets.

Yanukovych thus has turned increasingly to Europe. But democratic backsliding and, in particular, the trial of Tymoshenko have badly hurt his image in the West. Yanukovych’s prosecutor general charged Tymoshenko with abuse of power for the 2009 gas contract that she concluded with Russian Prime Minister Vladimir Putin. That agreement ended a winter gas war that had cut the flow of Russian gas to Ukraine and Europe, plunging several EU member states into crisis. Whatever one may think of the contract—several analysts have pointed to flaws—no one in the West regards its signing as a criminal matter. They instead see a poorly disguised manipulation of Ukraine’s courts to settle political scores. The judge in the trial compounded the problem by ordering Tymoshenko’s jailing, when she poses little risk of flight.

Yanukovych has heard plenty about the Tymoshenko case. Just recently, Secretary Hillary Clinton and EU High Representative for Foreign Affairs and Security Policy Catherine Ashton sent a joint letter to Yanukovych, and German Chancellor Angela Merkel phoned him. Western diplomats have regularly raised the question at other senior levels in Kyiv. European parliamentarians, moreover, have publicly threatened to block ratification of the association agreement and free trade arrangement if they are signed.

Yanukovych got an earful at the September 16-17 “Yalta European Strategy” conference. Following his opening address, the second question centered squarely on Tymoshenko. That presaged a spate of critical comments by questioners and conference panelists, all pounding the same theme: Kyiv needs to stop the trial and release Tymoshenko, or its European integration hopes will go nowhere. European officials made the same point in private discussions with the Ukrainian president on the margins of the conference.

Does Yanukovych now get it? Maybe. His answer to the Tymoshenko question—which was carefully worded and most likely thought through in advance—opened a door to a possible solution by noting that the Rada (Ukraine’s parliament) will examine certain provisions of the criminal code and may decide to remove them. Rada deputies have already proposed dropping the law that is the basis for the charges against Tymoshenko.

This could offer an elegant way out of the mess. If the Rada removes the relevant provision from the criminal code, it would eliminate the grounds for the Tymoshenko trial. Ukrainian analysts and Western diplomats at the Yalta conference expressed some optimism that the door to a solution might now be open—though one skeptic observed that the door had opened to a long corridor. All politics in Ukraine are transactional.

Tymoshenko’s release certainly would not erase all the Western concerns about democratic backsliding. Indeed, EU officials make clear that she must be freed and also allowed to participate in politics, including running in future elections. But her release and return to normal politics would mark a good first step.

The decision is Yanukovych’s to make. His support would guarantee his party’s votes in the Rada to pass the proposed amendments of the criminal code. He can choose to release Tymoshenko—as distasteful as he may find that— and get out of this hole. Otherwise, Ukrainian officials should expect to hear about her case in meeting after meeting after meeting with European and American officials, and resign themselves to impasse in Ukraine’s European integration effort.