The Ukrainian prime minister headed to Moscow on Monday as Russia and Ukraine prepared to sign a deal ending a contentious dispute that cut off Russian natural gas shipments to Europe for nearly two weeks.

Yulia Tymoshenko and her Russian counterpart Vladimir Putin reached a preliminary agreement over the weekend to restore gas supplies to Europe and Ukraine.

Click to view photos.

Tymoshenko's office said a formal deal on the shipments will be signed Monday by Russia's gas monopoly Gazprom and Ukraine's Naftogaz. Naftogaz says it will take up to one and a half days to pump gas to its western border once Russia restarts deliveries.

Russia stopped shipping gas to Ukraine for domestic use on Jan. 1 in a dispute over prices. It then halted all gas shipments to Europe via Ukraine on Jan. 7, alleging that Ukraine was siphoning off Europe-bound gas. Ukraine disputed this, claiming that Russia was not sending enough "technical gas" to push the rest further west.

The confrontation deeply shook Europeans' trust in both Russia and Ukraine as reliable energy suppliers and forced over 15 nations to scramble to find alternative sources of energy. The dispute was further complicated by geopolitical struggles over Ukraine's future and over lucrative export routes for the energy riches of the former Soviet Union.

In what appeared to be a victory for Russia, Tymoshenko and Putin negotiated a preliminary deal for Ukraine to get gas with a 20 percent discount from average European prices this year, which Russia says is $450 per 1,000 cubic meters. That would make Ukraine pay about $360 per 1,000 cubic meters in the first quarter, doubling the price it paid in 2008.

However, natural gas prices for Europe are expected to fall sharply later this year, due to the fall in oil prices. By midsummer, Ukraine could be paying as little as $150 for 1,000 cubic meters, said Ronald Smith, a strategist at Moscow's Alfa Bank.

Russia won a key principle, however, that Ukraine must pay more for its energy supplies. Russia also won't have to pay higher transit prices to Ukraine this year to use its pipelines.

Putin said in 2010, Ukraine will have to pay full price for Russian gas, and Russia would pay market prices for transit.

In the long term, it is not clear how Ukraine will pay for the huge amount of Russian gas needed to run its outdated factories and heating systems.

Opposition leader Viktor Yanukovych said any gas price higher than $250 would be mean a "collapse" of the economy, coping with a collapse of the national currency, a drastic fall in exports and a shaken banking sector.