The world's largest oil exporter has made quite a policy swerve. Within six weeks, Saudi Arabia has gone from advocating higher prices to trying to stop the rally at $80 a barrel.

The U-turn scrambled the outlook for oil markets, hit the share prices of oil majors and shale producers and set up a diplomatic wrangle with other members of the Organisation of Petroleum Exporting Countries.

What changed? The supply threats posed by the reimposition of US sanctions on Iran oil exports earlier this month and the quickening collapse of Venezuela's energy industry are both part of the answer, but they're secondary to Donald Trump, pictured. On April 20, the president took to Twitter to lambast the cartel's push for higher prices. "Looks like Opec is at it again," he tweeted. "Oil prices are artificially Very High!" Trump's intervention gave typically strident voice to a concern held more widely in the US and other consuming countries: oil's rally from less than $30 in early 2016 to more than $80 this month risked becoming a threat to global economic growth.

On Friday, Saudi Oil Minister Khalid Al-Falih responded, saying his country shared the "anxiety" of his customers. He then announced a shift in policy that all but gave a green light for a market sell-off, saying Opec and its allies were "likely" to boost output in the second half of the year.

"The tweet moved the Saudis," said Bob McNally, founder of consultant Rapidan Energy Group LLC in Washington and a former White House oil official. "The message was delivered loud and clear to Saudi Arabia."

After Al-Falih's comments, made following a meeting with his Russian counterpart in St ﻿Petersburg, Brent crude promptly dropped below $77 a barrel. The bullish tone of recent market chatter, increasingly punctuated with talk about oil prices climbing past $100, $150 and even $300, suddenly looks overdone.

It wasn't just the US. Other major buyers of Saudi crude also put pressure on Riyadh to change course, albeit a little more diplomatically than Trump. Dharmendra Pradhan, the Indian petroleum minister, said he rang Al-Falih and "expressed my concern about rising prices of crude oil".

Opec officials were at Jeddah's opulent Ritz-Carlton hotel on Saudi Arabia's Red Sea coast when Trump tweeted his views and they immediately saw it as a significant intervention. "We were in the meeting in Jeddah, when we read the tweet," Opec Secretary General Mohammad Barkindo said on Friday. "I think I was prodded by his excellency Khalid Al-Falih that probably there was a need for us to respond," he said. "We in Opec always pride ourselves as friends of the United States."

Diplomats and oil officials in Opec countries were also worried about the potential revival in Washington of the so-called "No Oil Producing and Exporting Cartels Act," which proposes making Opec subject to the Sherman anti-trust law, used more than a century ago to break up the oil empire of John Rockefeller.

The bill first gained prominence in 2007 when George W Bush was president and oil prices were flirting with $100 a barrel and made a comeback several years later under Barack Obama. While it was opposed by those presidents, the risk for Opec was that Trump "could break with his predecessors and support its passage," said McNally.

In a sign that oil prices were climbing, Washington's agenda as gasoline prices approached the $3 a gallon mark, last week a sub-committee in the US House of Representatives held a rare hearing on the Nopec act. Opec and its allies will gather in Vienna for a policy meeting on June 22 to hammer out a deal. While Al-Falih and Russia's Novak have indicated that output will most likely increase, the details - how many barrels from which countries - are still a question mark.

"In an environment of low inventories and rising geopolitical outages, raising some supply is prudent," said Amrita Sen, oil analyst at Energy Aspects Ltd. Oil producers are debating an increase ranging from 300,000 barrels a day at the low end, backed by Gulf producers including Saudi Arabia, and a larger increase of about 800,000 barrels a day favoured by Russia, a person familiar with matter said. "It's too early now to talk about some specific figure, we need to calculate it thoroughly," Novak said.

Even though Al-Falih's comments brought about an immediate price reaction - towards the end of Friday's session, Brent crude prices were down 3.3pc to $76.202 per barrel after a Reuters report said Saudi Arabia and Russia were in talks about raising oil production by one million barrels a day - there are still reasons for people to be bullish as traders await the impact of US sanctions against Iran and wider political tensions in the Middle East.

And with global oil demand growing strongly, hedge funds will shift their focus on diminishing global spare capacity as Opec returns barrels to the market. The US government estimates the cushion at just 1.34 million barrels a day next year, below the 1.4 million reached in 2008 when oil prices surged to nearly $150 a barrel.

In a letter to investors earlier this month, Pierre Andurand, the bullish oil hedge fund manager, warned that if Saudi Arabia needs to "offset production declines from Iran and Venezuela" global spare capacity would decline to perilous levels.

"Oil prices could potentially surge to record high levels to force demand destruction very quickly," he wrote.