Correction: An earlier version of this story misstated the month in which Yuri Lutsenko, Ukraine’s former interior minister, was released from prison. He was freed in April, not July. This version has been corrected.

Ukrainian President Viktor Yanukovych speaks during a TV interview in Kiev, Ukraine, on Aug. 29. (Mykhailo Markiv/Ukrainian Presidential Press Service via Reuters)

In this part of the world, political leaders often find themselves landing in jail when they fall out of favor. Such a situation led to a testy exchange Friday between the president of Ukraine and a political opponent who was released from prison two months ago.

The point of contention was the continued incarceration of Yulia Tymoshenko, the former prime minister and bitter electoral foe of President Viktor Yanukovych, and it resulted in a sarcastic back-and-forth in front of hundreds of rapt political and business leaders from dozens of countries.

Her trial and imprisonment has attracted worldwide attention and sharp criticism from the United States and the European Union over what they call “selective justice.”

This matters to Ukraine, which wants to sign a cooperation agreement with the E.U. despite escalating pressure against the move from Russian President Vladimir Putin, who has been trying to intimidate Yanukovych.

But European leaders say Tymoshenko must be released as part of a series of reforms. Yanukovych says the situation is complicated — she was convicted of abuse of office for signing an expensive gas deal with Putin’s Russia in 2009.

But at the Livadia Palace, where World War II allies Joseph Stalin, Winston Churchill and Franklin D. Roosevelt met in March 1945 to carve up postwar Europe, Yuriy Lutsenko, who was the interior minister in Tymoshenko’s government, pointed out that the president could easily join Ukraine to modern-day Europe with the stroke of a pen.

Yanukovych pardoned Lutsenko in April. He had been serving a four-year sentence, also for abuse of office, and now, the former prisoner said, Yanukovych could do the same for Tymoshenko.

“I’m really thankful that this experiment on me was stopped,” a thin and blue-suited Lutsenko said during a question period at an economic forum, sounding not very thankful at all. “I call on you, the president who is not afraid of Putin — don’t be afraid of Tymoshenko, either. Just take a pen and sign a decree.”

Don’t flatter yourself, the burly Yanukovych replied. “You’re not even in her weight class,” he said. “Don’t try to compare yourself.”

Then he barked at Lutsenko to stand up so he could see him past a small dais. Lutsenko, in the second row of the audience, rose.

“I’m glad to see you here,” Yanu­kovych told him, sounding not a bit glad. “There is no person more interested in solving this case, but there are obstacles,” he said. “The answer is compromise.” He did not spell out what kind of compromise.

The ornate palace’s White Room was full of officials from the E.U., which hopes to sign the agreement with Ukraine in November. Ukrainian politicians and analysts have been speculating that Tymoshenko, who suffers from a back ailment, could be released any day to help seal the pact.

“It’s not easy,” Yanukovych said. The problem, he suggested, was in working out some sort of “legal framework” that would allow him to free her. As for Tymoshenko’s weight class, he did not explain how that would figure into his decision.