* President Xi says China will take share in Kashagan
* Sale foils attempt by India to gain a stake
* Kashagan seen starting commercial output in 3-4 weeks
* China and Kazakhstan agree deals worth $30 bln -Nazarbayev
By Mariya Gordeyeva
ASTANA, Sept 7 (Reuters) - Chinese President Xi Jinping struck a deal with Kazakhstan on Saturday giving China a stake in its giant Kashagan oil project, a highlight of his tour of Central Asia to secure hydrocarbons for the world's largest energy consumer.
The $5 billion deal further increases China's rising clout in post-Soviet Central Asia, once Russia's imperial backyard, and blocks an attempt by global rival India to get a stake in the oilfield, the world's largest oil discovery in five decades.
"The two countries have agreed on China's shareholding in the development of the Kashagan deposit," Xi told a news briefing after talks with Kazakh President Nursultan Nazarbayev. "The two governments hail and support this agreement."
Oil and gas deals, including on building an oil refinery in Kazakhstan, are among 22 agreements worth some $30 billion reached during Xi's visit, Nazarbayev said.
Under the Kashagan deal, Kazakhstan will sell 8.33 percent of the offshore oilfield in the Caspian Sea to China for about $5 billion.
The sale and purchase agreement was signed by the heads of Kazakh state oil and gas company KazMunaiGas and China National Petroleum Corp (CNPC) in the presence of the two presidents.
"We suppose that the transaction will be closed by late September or late October," a Kazakh official told Reuters.
CNPC will also pay up to $3 billion to cover half of Kazakhstan's financing of the second phase of Kashagan's development, KazMunaiGas head Sauat Mynbayev told reporters. This phase is expected to start after 2020.
Another draft agreement, seen by Reuters, would guarantee loans from The China Development Bank and The Export-Import Bank of China - worth respectively $3 billion and $5 billion - to Kazakhstan's state holding firm Baiterek, which promotes innovation and industrial projects.
China is already involved in a number of oil projects in its vast resource-rich neighbour, which is five times the size of France but has a population of just 17 million.
This week, Xi visited Kazakhstan's neighbour Turkmenistan, which holds the world's fourth-largest natural gas reserves, and oversaw deals aiming to boost gas supplies and build a pipeline to China.
INDIA'S HOPES DASHED
The Kazakh deal comes after Astana decided in July to use its pre-emptive right to buy an 8.4-percent stake in Kashagan that U.S. oil major ConocoPhillips was selling for $5 billion.
Houston-based ConocoPhillips, whittling down its worldwide portfolio of assets, announced last year it had agreed to sell the stake to ONGC, the overseas arm of the Indian state-run company.
The sale to CNPC blocks India's plan to enter Kashagan.
Kazakhstan, home to 3 percent of the world's recoverable oil reserves, has moved in recent years to exert greater management control and secure bigger revenues from foreign-owned oil and gas projects.
KazMunaiGas entered the Kashagan consortium as a shareholder in 2005 and has since then doubled its stake to 16.81 percent.
Kashagan and neighbouring fields in the North Caspian hold estimated reserves of 35 billion barrels of oil, with between 9 billion and 13 billion barrels recoverable.
A multinational consortium developing the field has invested some $50 billion in about 13 years, making it the costliest oil project in the world.
Trial runs at the giant reservoir off western Kazakhstan are set to begin on Monday, and it may take between three weeks and a month before commericial production starts, Mynbayev said.
During Kashagan's development, production will be gradually increased to 370,000 barrels per day in the second stage from 180,000 bpd in the first stage in 2013-14, according to North Caspian Operating Company (NCOC), which is developing the field.
Italy's ENI, U.S. major ExxonMobil, Royal Dutch Shell and France's Total each hold 16.81 percent stakes in Kashagan. Japan's Inpex owns 7.56 percent.