The president of Azerbaijan accused BP of stealing billions of dollars of oil from his country and using "mild blackmail" to secure the rights to develop vast gas reserves in the Caspian Sea region, according to leaked US cables.

Ilham Aliyev said the oil firm tried to exploit his country's "temporary troubles" during a gas shortage in December 2006. In return for making more gas supplies available for domestic consumption that winter, BP wanted an extension of its lucrative profit-sharing contract with the government and the go-ahead to develop Caspian gas reserves, one cable from the US embassy in Baku reports. Aliyev also threatened to make BP's alleged "cheating" public, cables show.

The leaks reveal the extent of the company's power over Azerbaijan's government. BP controls the country's crucial energy projects and is its largest foreign investor. One cable reveals BP was so concerned about a terrorist attack on its offshore facilities, and about the lack of protection offered by the government, that it provided Azerbaijan's naval forces with "off-the-shelf" anti-collision radar to cover the company's platforms – "the best one that the navy currently has", according to BP.

Aliyev's hostility towards the company vanished, say the cables, after Russia invaded neighbouring Georgia in August 2008. The invasion – and a major explosion caused by Kurdish rebels on Azerbaijan's Baku–Tbilisi–Ceyhan pipeline, controlled by BP – heightened the Aliyev government's insecurity in an unstable region.

According to one cable shortly after the invasion, "Aliyev's expressed intention to reopen discussion with BP … after a long period of inaction, is significant, and likely a result of a new appreciation for the security benefits of a significant western presence in the energy sector in the wake of regional developments."

BP is the biggest shareholder in the regionally strategic $4bn (£2.6bn) Baku–Tbilisi–Ceyhan pipeline, which carries more than 1m barrels of oil a day on a 1,000-mile journey from the Caspian to Turkey. BP is also the largest shareholder and operator of the Azeri-Chirag-Guneshi field, Azerbaijan's largest producing oilfield in the Caspian reserve, where vast undeveloped gas reserves also lie.

The row centred on how the consortium operating the Azeri-Chirag-Guneshi field, led by BP, would share profits with the government in what is known as a production sharing agreement (PSA). The contract was signed in 1994 and, as is customary, allowed for the companies initially to take more of the revenues to pay off their upfront costs to develop the field, with a higher proportion of revenues going to the government subsequently.

But in April 2007, according to the cables, BP told the state-controlled oil company Socar that because of higher transport costs and delays in production, the agreed staggered increases in government profits allocated to the government would take longer to materialise. The government was also reportedly unhappy with other aspects of its dealings with BP and its partners and production delays.

In one cable in October 2007 Socar threatened "extra-legal" measures against the consortium and to have BP's Azerbaijan boss, Bill Schrader, put on trial for "stealing ten billion dollars worth of Azerbaijani oil". Another cable that month reads: "If a good response is not found, Azerbaijan 'will make public that BP is stealing our oil', [President] Aliyev stated."

At the time BP was pressing the government for an extension of the production sharing agreement and also wanted to develop vast gas reserves – "deep gas" – under the Azeri-Chirag-Guneshi field.

Under the heading "BP's dangerous game", the cable reported: "Aliyev said it was inappropriate for BP to link all of its issues such as PSA extension, ACG deep gas, transportation tariff agreements and others into one bundle; it also was inappropriate for BP to link the solution of those issues to Azerbaijan's 'temporary troubles'. He said BP was using 'mild blackmail' and argued that BP must instead act in good faith."

As recently as July 2008, a cable described negotiations between BP and the government as deadlocked.

The next month, the government appeared to drop its threats and be willing to co-operate over BP's demands. In August 2008, BP's then head of exploration, Andy Inglis, briefed the US ambassador to Baku about his one-hour meeting with the president. Inglis was said to have "described the mood about BP in Azerbaijan as having come full circle". "The president said he knows he needs to keep BP motivated and interested in Azerbaijan," the ambassador continued, adding that there had been "good discussion" about BP's demands on developing the country's oil and gas reserves.

The cable also said: "Azerbaijan had been holding a firm line in negotiations on production sharing agreement extension and 'deep gas' … Recent events in Georgia, however, may be causing Azerbaijan to reconsider its line, according to BP's representatives."

In July 2009, according to BP's annual report, BP and Socar signed an agreement to explore and develop a huge deepwater gas field in the Caspian which gave the British company the "exclusive" right to negotiate a production sharing agreement.

Responding to the leaked cables, the oil company said it could not comment on confidential discussions with Socar and the government of Azerbaijan.

"BP continues to have a successful and mutually beneficial partnership with the government of Azerbaijan. This has produced and continues to produce benefits to all parties involved and most importantly to the nation of Azerbaijan," it said.

"The government of Azerbaijan has entrusted us with the development of major oil and gas development projects on the basis of PSAs enacted as laws in Azerbaijan. The operatorship of PSAs of this scale require cooperation and alignment between contractors and government. BP in Azerbaijan enjoys the continued support and goodwill of the government and the people of Azerbaijan to meet its obligations.

"As part of maintaining this successful partnership we meet and discuss business related matters with relevant parties including our partners, Socar and the government. These discussions are confidential and as such we will maintain that confidentiality and not comment on specifics."