BP remains on the verge of agreeing a $27bn (£17bn) deal that would allow the oil company to extricate itself from a troubled joint venture in Russia, but force it to forge closer ties with the Kremlin.

The transaction with Rosneft, the oil firm which is 75%-owned by the Russian state, will involve BP selling its stake in the profitable but problematic TNK-BP joint venture it forged in 2003 to Rosneft.

With the City expecting an announcement early this week, the UK-based company said in a holding statement on Monday: "BP confirms it is in advanced discussions with Rosneft regarding the sale of its 50% interest in TNK-BP. No agreement has yet been reached. A further announcement will be made if and when an agreement is reached."

Under the terms Rosneft is likely to become the biggest stock market-listed oil company in the world, while BP will become the second biggest investor in the company after the Russian state.

BP is expected to end up with a stake of as much as 20% in Rosneft, securing a major presence in the world's biggest oil and gas province, and taking at least one seat on the board of the company which is led by an ally of the Russian president, Vladimir Putin.

The transaction is crucial to BP as it provides an exit from the TNK-BP venture which has posed a series of difficulties for the firm, including the departure of Bob Dudley from Russia in 2008 when he was head of the venture. It has required $8bn of investment by BP which in turn has taken out $19bn in dividends.

Dudley, now chief executive of BP, has told his board that he backs the cash and share deal for the 50% TNK-BP stake, which will eventually allow him to hand out billions to BP shareholders.

Rosneft is expected to buy out the other half of the TNK-BP joint venture from the local oligarchs known as AAR, which had previously prevented BP from taking a larger stake in Rosneft.

BP will receive $10bn-$14bn in cash from Rosneft and take shares in the Russian company in which it already owns a 1.25% stake after the partial sell-off in 2006.

While there has been speculation that the Kremlin will reduce its stake in Rosneft to as low as 50% plus one share, this is yet to happen. Igor Shuvalov, Russia's deputy prime minister, has said that the government would consider further privatisation in an attempt to soothe any concerns among BP investors about the influence of the Kremlin over such a crucial part of the UK oil firm whose share price is yet to recover from the Deepwater Horizon disaster in the US in April 2010. BP gets a quarter of its production from the existing Russian venture.

Dudley's Rosneft counterpart, Igor Sechin, is a former spy who flew to London last week to take control of the long-running negotiations and whose company has long been attractive to BP. In January 2011 BP and Rosneft announced a share swap to enable them to explore in the Russian Arctic until AAR blocked the transaction. BP's technical expertise is likely to be essential if the Russian Arctic is to be explored, although this is likely to anger environmental campaigners. BP is also keen to get more expertise from Russia, a market which produces 10m barrels of crude oil every day, and is considering whether to appoint a Russian national to its board. An announcement on the identity of any new board members is not thought to be imminent.