After a decade of high-stakes haggling, China and Russia have finalized an agreement on natural gas sales in one of the world's biggest energy deals.

The 30-year contract will provide China with a pipeline for Siberian gas while giving Russia a financial lifeline as it faces sanctions in Europe for taking territory from Ukraine.

Russian President Vladimir Putin sealed the agreement during a visit to Shanghai hosted by Chinese President Xi Jinping on May 20-21 after years of bargaining over the starting price for supplies.

Questions of project costs

The deal struck in the early morning hours of round-the- clock talks may have saved Putin from an embarrassing setback, but questions may continue for Russia over the contract's profitability and project costs.

"This is indeed a historic event for the gas sector of Russia and of the Soviet Union," Putin said in remarks quoted by Reuters as he presided with Xi over the signing ceremony.

"This is the biggest contract in the history of the gas sector of the former USSR."

The exact terms remain a commercial secret, but Putin's comments suggested that state-owned Gazprom may have been forced to make major concessions to China on pricing in order to get the deal done.

"Our Chinese friends are difficult, hard negotiators," Putin said.

Under the agreement with China National Petroleum Corp. (CNPC), Gazprom will build a pipeline from Siberian fields to pump 38 billion cubic meters (1.3 trillion cubic feet) of gas to eastern China annually by 2018.

'Principle of mutual trust'

While the new gas source may be a major step forward for China's efforts to reduce reliance on high-polluting coal, Beijing initially said little about the agreement.

"The deal ... fully embodies the principle of mutual trust and mutual benefit of China and Russia," CNPC said in a statement, according to the official Xinhua news agency.

Putin said Russia would spend U.S. $55 billion on pipeline and field development on its territory. Gazprom CEO Alexei Miller put the value of the contract at U.S. $400 billion.

The rough total suggests a gas price of slightly over U.S. $350 (2,181 yuan) per thousand cubic meters, which is about 8 percent below Russia's export prices for Europe but about 9 percent above China's reported cost for gas from Central Asia.

Negotiations have been stalled for years over Russian insistence that Gazprom sales in the east should be just as profitable as those in Europe, while CNPC has balked at paying European-level import costs.

Russia squeezed

The outlines of the deal suggest that Russia has been squeezed between the high costs of developing resources in the harsh conditions of eastern Siberia and the commercial realities of the Chinese market.

"It's difficult to make the numbers work for both sides," said Edward Chow, senior fellow in the energy and national security program at the Center for Strategic and International Studies in Washington. "There are some genuine economic problems with this project."

Pressure on Russia from the risk that Europe will reduce its reliance on Gazprom in the wake of the Ukraine crisis appears to have played a role in Moscow's decision to accept lower rates.

Speaking days before the agreement, a Chinese official denied reports that Beijing might gain leverage in the price talks from the Ukrainian conflict.

"Rumors that the Chinese side is trying to use current events in Ukraine to secure a reduction in the price of Russian gas are in no way true," said Zhang Xin, CNPC head of external communications, according to Interfax.

That appeared to be contradicted by Putin presidential aide Yury Ushakov, who was asked by reporters in Moscow whether conflicts with Ukraine had affected the talks.

"Obviously, they do affect them to some extent," he said.

Now-or-never decision

The combination of factors confronted Russia with a now-or-never decision and concerns that commercial conditions for a deal might never improve.

"We may not see a project for a very, very long time if the numbers don't work this time," Chow said.

Russia is believed to have cut prices substantially in the last days of negotiations to bridge a gap that was the equivalent of some U.S. $71 per thousand cubic meters, or U.S. $2.7 billion a year at projected volumes, based on bargaining positions previously reported by Reuters.

Over the life of the contract, the difference would be nearly U.S. $81 billion, which is more than Russia's annual defense budget. The stakes for Russia in holding out for higher prices were huge.

But the political opportunity for Putin to avoid isolation on the world stage may have been priceless.

The gas deal capped the Russian leader's visit for the summit of the Conference on Interaction and Confidence-Building Measures in Asia (CICA) after announcing over 40 other accords with China.

The gas agreement may have been sweetened with Russian arms sales or other incentives that would not be transparent, Chow said.

Concerns raised

Despite the breakthrough, even the few details that have been released may raise further concerns about Russia's ability to fulfill the gas contract and meet the 2018 target.

Bloomberg News quoted Russian Energy Minister Alexander Novak as saying that China "may make as much as [U.S.] $25 billion in advance payments" to support Russia's development costs.

But the financing was not included as part of the contract, the Associated Press reported.

Chow said he had expected that an upfront payment of at least U.S. $50 billion would be part of the deal.

"This is money that Russia needs quite desperately, even more now as the result of the Ukraine crisis that they created," said Chow.

Gazprom Export CEO Alexander Medvedev said a prepayment of U.S. $25 billion had been agreed "in principle," Reuters reported, leaving the issue unclear.

The Kremlin's RIA Novosti news service also quoted Novak as saying that gas deliveries "may begin in the next four to six years," raising doubts about the 2018 timeframe and the pace of supply plans.

Gazprom expects gas production to begin in late 2018 at its 1.45-trillion-cubic meter Chayanda field in eastern Siberia, the company said in a statement Friday. Supplies to China would start in 2019, Interfax said.

Reliant on Chinese loans

With pressure rising from sanctions over the seizure of Crimea and its economy facing recession, Russia may find Western financing costly or unavailable, leaving it more reliant on loans from Chinese state-owned banks to make the export deal work.

While China is expected to seek greater access to investment opportunities on Russian territory than Moscow has previously allowed, it is also likely to be wary about heavy reliance on any single energy source.

Some analysts have argued for years that there must be a strategic fit between the two neighboring countries, which represent the world's biggest energy market on the one hand and one of the largest sources of supply on the other.

But mutual suspicions and price disputes have led to repeated delays.

Russia opened its first cross-border pipeline to China for oil deliveries less than four years ago after countless postponements, and it remains the only direct pipeline link for either oil or gas between the two countries to date.

In the meantime, state-owned CNPC has invested heavily in its Central Asia Gas Pipeline (CAGP) system, developing gasprimarily in Turkmenistan where it has equity stakes and greater control over supplies.

Competition

In the week before Putin's appearance, Xi also added pressure by hosting Turkmen President Gurbanguly Berdymukhammedov for a three-day state visit, underscoring the competition between Russian and Central Asian gas supplies.

Among other accords, China agreed on a target of importing 65 bcm per year of Turkmen gas by 2016, according to a joint statement cited by the official Xinhua news agency.

The timeline represents a major acceleration from the previous goal of 65 bcm by 2020, putting Turkmenistan far ahead of Russia as a source for gas.

Last year, the CAGP system carried some 27 bcm, mainly from Turkmenistan, accounting for over half of China's imports. The country produced 117.6 bcm of gas and imported 53 bcm, according to the Ministry of Land and Resources and CNPC.

In March, CNPC said the CAGP would deliver 80 bcm to China by 2020, accounting for 40 percent of projected imports of 200 bcm per year. The statement made no mention of the pending Russian deal.

In April, the central government said in a statement that China's total gas supplies in 2020 would reach 420 bcm per year.

Controversial pipeline

Russia has said the volume of its deliveries to China could rise to 68 billion cubic meters (bcm) per year with the addition of a controversial western pipeline to Xinjiang that Moscow initially announced during a Putin visit nearly eight years ago.

But China has repeatedly made clear that the western route is not a priority, since Xinjiang is already supplied with its own resources, as well as the CAGP route.

On the positive side for Russia, the slew of accords with China may improve its chances of boosting bilateral trade to $100 billion (623.5 billion yuan) annually by 2015, a goal first set in 2011.

Last year, trade growth edged up only 1.1 percent to $89.2 billion, according to Chinese official data, as imports from Russia fell 10.3 percent to $39.6 billion.