The move by the UK-listed company to abandon its holding will cost it charges of up to $25bn (£19bn) and comes after growing pressure from the British government over its relationship with Rosneft.
In a statement released on Sunday, the oil group also said its chief executive Bernard Looney is resigning from Rosneft's board with “immediate effect”.
BP said Russia’s attack on Ukraine represented a “fundamental change” in how the company could operate there.
On Sunday, Mr Putin ramped up tensions with the west after he placed Russia’s nuclear deterrence forces on high alert, in response to sanctions from the US, EU and UK.
Rosneft is also part-owned by the Russian government, and BP has held the 19.75 per cent stake in the firm since 2013.
BP chairman Helge Lund said: “Russia’s attack on Ukraine is an act of aggression which is having tragic consequences across the region. BP has operated in Russia for over 30 years, working with brilliant Russian colleagues. However, this military action represents a fundamental change.
“It has led the BP board to conclude, after a thorough process, that our involvement with Rosneft, a state-owned enterprise, simply cannot continue. We can no longer support BP representatives holding a role on the Rosneft board.
“The Rosneft holding is no longer aligned with BP’s business and strategy and it is now the board’s decision to exit BP’s shareholding in Rosneft. The BP board believes these decisions are in the best long-term interests of all our shareholders.”
Mr Looney added: “Like so many, I have been deeply shocked and saddened by the situation unfolding in Ukraine and my heart goes out to everyone affected.
“It has caused us to fundamentally rethink BP’s position with Rosneft.
“I am convinced that the decisions we have taken as a board are not only the right thing to do, but are also in the long-term interests of BP.”
Business Secretary Kwasi Kwarteng held a virtual call with Mr Looney for around 20 minutes on Friday to discuss the company’s position.
On Sunday, he said: “I welcome BP’s decision to exit its shareholding in Rosneft oil company.
“Russia’s unprovoked invasion of Ukraine must be a wake-up call for British businesses with commercial interests in Putin’s Russia.”
BP admitted last year that sanctions on Russia could be problematic for its business, as global leaders are lining up to impose an even more stringent economic retaliation against the Kremlin.
The company, which co-owns Rosneft with the Russian government, said in its annual report that “events in or relating to Russia, including trade restrictions and other sanctions, could adversely impact our income and investment in or relating to Russia”.
Additional reporting by agencies
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies