Noureddine Boutarfa, the Algerian oil pastor who hosted the coming week OPEC meeting, resorted to one of the oldest tricks in the dealmakers volume: He put his fellow ministers in the same hotel in the middle of nowhere.

The strategy worked. Corralled on two floors of the Sheraton Club des Pins Resort, a hotel with the appearance of a corporate headquarters about a 40 -minute drive from central Algiers, representatives of the Organization of Petroleum Exporting Countries had little to do except talk to each other.

Boutarfa himself left his Algiers residence to check into one of the hotels suites so he could mediate between regional rivals Saudi Arabia and Iran. After two days, he proclaimed victory — OPEC agreed Wednesday on the outlines of its first production cut in eight years. The details still need to be ironed out.

The announcement signals that OPEC seems to be ready to return to supply management after letting the market largely re-balance itself over the past two years, told Gordon Gray, global head of oil and gas equity research at HSBC Holdings Plc in London.

Despite the dramatic announcement in Algiers, which followed a virtually five-hour OPEC meeting, the seeds of a policy shifting were planted months ago.

New Minister

In early May, Ali Al-Naimi, the designer of the pump-at-will policy OPEC adopted in late 2014, retired after 20 years as Saudi oil minister. His successor, Khalid Al-Falih, initially supported the policy he inherited from Al-Naimi, but he also wanted to construct his own mark, according to people familiar with the Saudis thinking who asked not to be named.

Al-Falih started his tenure by actually attempting to mend his countrys relations within the organization, particularly with Iran and Venezuela, during the June OPEC meeting in Vienna. He also encouraged ongoing back-channel conversations involving Qatar, Algeria, Russia and Iran.

By the middle of August, Riyadh had determined that its strained economy needed a boost that higher oil prices could provide — not a return to the old days of $100 -plus a barrel, necessarily, but certainly something higher than $50 a barrel. Without policy interventions, health risks was a return to costs below $40 a barrel and the looming specter of more unpopular domestic austerity measures. In addition, Saudi Arabia started to worry that current prices would reduce farther investment in new energy projects, contributing to an uncontrollable boom cycle.

After Sanctions

But Saudi Arabia and Iran remained far apart. Tehran insisted on accommodations because of its emergence from nuclear sanctions, which curbed its production for years, according to a person briefed by Iranian officials. Iran argued that Saudi Arabia should cut its output back below 10 million barrels a day. The countries had differing opinions of what Iran should produce. Riyadh wanted Tehran to freeze at a level of 3.6 million barrels per day, while Iran insisted on production of at least 4.2 million barrels.

The gap narrowed in sessions in Moscow, Paris and Vienna. But as recently as a month ago, discrepancies between Saudi Arabia and Iran was still roughly 1 million barrels a day, about the same output of fellow OPEC member Algeria.

Putin Involved

Government officials got involved. At the G20 summit in Hangzhou, China, in early September, Russian leader Vladimir Putin sat down with Saudi Arabia Deputy Crown Prince Mohammed bin Salman. Hours subsequently, Saudi and Russian oil ministers appeared in a joint press conference. The message was clear: Riyadh and Moscow were working together.

The final move came over the last 10 days, with a two-day secret meeting in Vienna involving senior Saudi, Iranian, Qatari and Algerian delegates. The officials didnt manage to resolve all their problems, but they narrowed the gap between Riyadh and Tehran to about 600,000 barrels a day.

On the eve of the OPEC talks in Algiers, Al-Falih made a final concession, for the first time went on to say that Iran — alongside Libya and Nigeria — should be allowed to produce at the maximum levels that make sense.

Gap Cut

The olive branch was well-received. By the time OPEC ministers collected on Wednesday afternoon, the gap was cut to only 200,000 to 400,000 barrels per day, according to people briefed on the matter. Bijan Namdar Zanganeh, the Iranian oil pastor, signaled the rapidly changing talks.

Its not a decision-making meeting, but after all I think big steps will be taken today, he told reporters in Algiers before the meeting began.

Five hours later, OPEC emerged with a bargain: a production cut that set an objective of 32.5 million to 33 million barrels a day, a little below current output.

Saudi Arabia and Iran have become more flexible in discussing the parameters by which OPEC is getting ready to achieve target levels, Russian Energy Minister Alexander Novak said on state television Thursday.

The work isnt done, however. The group, which accounts for virtually 40 percent of the worlds petroleum supplying, will discuss details of the bargain at its next meeting, are planned for Nov. 30 in Vienna.

There are plenty of world-class hotels spread throughout the heart of the Austrian capital. Negotiators will need new tricks.

Read more: