Russia and Ukraine have reached a deal to end a row over gas supplies which disrupted deliveries to a number of European countries. The BBC News website explains how the dispute arose and how it was resolved.
What was the row about?
On the surface, it was an economic dispute about the price Ukraine pays for Russian gas. The Russian gas giant, Gazprom, wanted to increase the price from $50 to $230 per 1,000 cubic metres. Ukraine rejected such a large increase and wanted any changes phased in.
Gazprom cut supplies to Ukraine on 1 January 2006 because of the failure to reach agreement.
So was it a purely commercial dispute?
Ukraine, and some Western commentators, said Russia was trying to punish it for attempting to withdraw from Moscow's sphere of influence and to strengthen ties with the European Union and Nato.
Russia rejected this allegation, saying it simply wanted a proper market price for its gas.
What was the impact on Western Europe?
Within hours of the cut to Ukraine's supply, other countries began reporting pressure drops in their pipelines. Austria, France, Germany, Hungary, Italy, Poland and Slovakia all reported drops of around 30%.
The European Union as a whole gets around 20% of its gas from Russia - and about 80% of that comes via pipelines crossing Ukraine.
The EU says the crisis has forced it to consider how to avoid becoming too dependent on gas from one source.
How was the dispute settled?
Under the deal, Ukraine will buy gas from a Swiss-registered company half-owned by Gazprom, called Rosukrenergo.
Rosukrenergo will buy gas from Gazprom at $230 per 1,000 cubic metres, and from Turkmenistan for much less.
It will supply gas from both sources to Ukraine, and Ukraine will pay an average of $95 per 1,000 cubic metres.
Did Ukraine steal gas intended for the EU?
Russia made this claim, but Ukraine denied it. In effect, the countries were arguing about access to cheap gas from Turkmenistan.
Up to now, Ukraine has bought gas separately from Russia and Turkmenistan - all of it supplied via the same Russian pipeline.
Ukraine continued to withdraw what it regarded as its Turkmen gas - but Gazprom said it was now buying up all the Turkmen gas entering Russia and none was left for Ukraine.
Under the new deal, Ukraine will buy more cheap Central Asian gas than before.
What can Western Europe do to ensure stable supplies?
The EU is discussing plans to increase its storage capacity, and to introduce a system that would oblige countries to share stored gas in case of emergency.
It can also look for other sources of gas, and other sources of energy apart from gas. In some countries the crisis has fuelled a debate on whether to build more nuclear power stations.
In the long term, Europe should benefit from a new pipeline running directly from Russia to Germany under the Baltic Sea. It is also looking forward to the construction of a pipeline from the Caspian region to Europe via Turkey.
What about the lessons for Ukraine?
Prime Minister Yuri Yekhanurov says Ukraine must start using energy more efficiently, and using less gas overall.
What do we know about Rosukrenergo?
It is a Swiss-registered company half-owned by a Gazprom subsidiary, and half-owned by an Austrian-registered company, Centragas, which is managed by an Austrian bank on behalf of undisclosed owners.
Rosukrenergo was formed in July 2004 to handle Turkmen gas exports to Ukraine, following discussions on the subject between Russian President Vladimir Putin and his Ukrainian counterpart at the time, Leonid Kuchma.
Last year the Ukrainian security service said it was investigating whether Rosukrenergo might have links to a Russian citizen on the FBI wanted list, Semyon Mogilevich.
Centragas has denied any connection with Mr Mogilevich.
How much does Russia charge Ukraine's neighbours?
Recent contracts with Belarus - one of Russia's closest allies - specify a price of $47, and deals with Armenia and Georgia are for around $110.
The Baltic states are also paying $110, but have agreed to a price rise in the future.
The average charge in the EU is $240.
In November 2005 Gazprom proposed charging Ukraine $160 per thousand cubic metres. The following month it abruptly raised the price to $220-230.
Who controls the pipelines?
Russia owns the pipelines on its territory, and has joint control of a pipeline that crosses Belarus.
Gazprom would have offered Ukraine a reduced price if it had sold the pipeline crossing Ukrainian territory.
It is also seeking to buy energy infrastructure in Georgia.