By Gabriel Gatehouse
BBC News, Kiev
Moscow has accused Kiev of siphoning off gas meant for EU customers
As Ukrainians prepare to go to the polls to elect a new president on Sunday, European leaders will be aware that the outcome could affect the continent's vital energy supplies.
Europe gets a quarter of its gas from Russia, and most of that arrives via an extensive network of pipelines running through Ukraine.
In the past few years, tensions between Moscow and Kiev have led Gazprom, the Russian energy giant, to switch off the taps on a number of occasions. With chilling results.
The latest incident came last January. Russia accused Ukraine of siphoning off gas meant for its European customers, and stopped the flow.
Hundreds of thousands of people in Central and Eastern Europe were left without heating in the middle of winter. Businesses and industries were forced to slash production.
In the past, incidents such as these had generally been regarded in the EU as a case of a powerful and assertive Russia bullying its smaller, more vulnerable neighbour.
This time though it became clear that Ukraine also shared some of the blame.
The following month there were extraordinary scenes at the headquarters of Naftogaz, the Ukrainian state energy company, in central Kiev.
Armed men in black combat fatigues and balaclavas stormed the company's offices, questioning staff and confiscating documents.
Ukraine's internal political tensions had spilled into the open: the security services, under the control of the president, had raided the state energy company, controlled by the prime minister.
At stake was control of the multi-billion dollar gas import and transit business.
"There are many many people in [the Ukrainian] political elite who made money out of this and who are still making money out of this," said Nico Lange, the Kiev-based director of the Konrad Adenauer Foundation, a German think-tank close to Chancellor Angela Merkel's Christian Democrats.
Germany is one of the largest importers of Russian gas, and Mr Lange is a veteran observer of the gas trade between Russia and Ukraine.
He believes these vested interests among the political elite will try to prevent reforms in the energy sector.
Both the frontrunners in the upcoming presidential election have a strong interest in the gas trade.
Viktor Yanukovych, currently ahead in the polls, has his political heartland in the east of the country, whose heavy industries need vast quantities of Russian gas to function.
His nearest rival, Yulia Tymoshenko, the current prime minister, made her money in the gas trade in the 1990s and has been nicknamed the Gas Princess.
Yanukovych was denied the presidency in 2004 due to fraud claims
On the face of it though, when it comes to trading gas between Russia and the EU, there should be no problem.
Russia has huge reserves of natural gas, which Europe needs. The question is, how to get that energy from the gas fields of Siberia to its European customers.
Under Stalin, the Soviet Union began construction of what became an extensive network of pipelines running from the east, funnelling gas into vast storage facilities on its western border, from where it could be easily supplied to Europe.
The trade continued even during the tense standoff of the Cold War. Supply and demand trumped ideology.
But when the Soviet Union collapsed, Gazprom, the newly created Russian state energy company, suddenly found that crucial elements of that network were located in a different country: independent Ukraine.
Still, for a decade and a half, the trade continued uninterrupted. Ukraine got cheap subsidised gas in return for allowing Moscow to effectively control the pipeline and storage system.
Then everything changed.
The Orange Revolution in the winter of 2004 installed a pro-Western president in Kiev. Viktor Yushchenko made it clear early on that he was no longer willing to dance to the Kremlin's tune.
"Control over the Ukrainian gas system is a question of Ukrainian sovereignty and finally of Ukrainian independence," said Nico Lange.
"If the Russian side - and this I think this has been and is still the long-term interest of the Russian side - gains control over the very huge transport system that is installed in Ukraine, this is a danger for Ukrainian independence."
The European Union has made it very clear it wants to see wholesale reform in the Ukrainian gas sector, to make the business more transparent.
Vladimir Putin has virtually endorsed Yulia Tymoshenko's candidacy
But Brussels has been frustrated by an apparent lack of resolve on the part of Ukrainian politicians.
This January, the anticipated gas crisis never happened. In November last year, Yulia Tymoshenko signed a new accord with her Russian counterpart, Vladimir Putin.
Russia agreed to waive stiff penalties for Ukraine, making it easier for Kiev to pay its bills. Mr Putin made it clear he was "comfortable" working with Mrs Tymoshenko when it came to the most sensitive - and lucrative - aspect of relations between the two countries.
This amounted to a virtual endorsement of her candidacy for the post of president. It is not clear what, if anything, Mrs Tymoshenko promised Mr Putin in return.
Her rival, Viktor Yanukovych has criticised the deal, saying it is bad for Ukraine. But his policies on gas are still likely to be more acceptable to the Kremlin than those of the current president, Viktor Yushchenko.
In an interview with the BBC, Mr Yanukovych's foreign affairs spokesman, Leonid Kozhara, said he could not rule out selling off part of Ukraine's network of pipelines and storage facilities to foreign companies, including Gazprom.
Mrs Tymoshenko and Mr Yushchenko were once close allies
"If we want to continue our role as the biggest transitor of Russian gas, we should think about the most effective transit system," he said. "Without Russian and European investment, this simply cannot happen."
Moscow has made no secret of the fact that it would like more control over Ukraine's gas transit system. The EU, on the other hand, wants to lessen its dependence on Russia and diversify its energy sources.
The current agreement between Moscow and Kiev seems to have averted a crisis this January. But much of the fine print has not been made public.
While the gas trade is conducted in back-room deals, shrouded in secrecy, it will continue to be a potential instrument of geopolitics, and Europe's energy supply remains far from secure.