In terms of Scotland's oil industry, the deal in Vienna over Iran's nuclear programme is more bad news.

There is little question that the lifting of economic sanctions and the eventual opening up of Iran's vast oil and gas reserves to western companies means only one thing. The effect will be to drive oil prices lower and for longer.

That is a parochial view however of a deal achieved only as a result of lengthy negotiations, which should leave the world considerably safer and significantly change the dynamics of Middle East politics.

The headline achievement is significant in itself. In return for the lifting of sanctions which have caused prolonged and significant suffering in Iran, the country's government will submit to restrictions which will prevent it developing nuclear weapons for at least a decade.

Concessions to Tehran will be counterbalanced by monitoring of its nuclear programme from every angle and the carrot of the lifting of UN sanctions is also a stick, with the deal including measures to reinstate them within 65 days if there is any breach.

Iran has agreed to an ongoing prohibition on acquiring missiles for eight years and most conventional weapons for five years.

Meanwhile opening the country up to the global economy has its own benefits, and it is clear America hopes economic improvements for Iran's citizens will also help bolster moderate elements in the country.

In terms of arms control the agreement is a hugely significant diplomatic achievement.

But much more than that, this deal opens up the real hope of achieving much more stability in the region.

Critics of the deal, of course, such as Binyamin Netanyahu, argue precisely the opposite, warning that it will increase instability and that America has effectively handed Tehran billions of dollars with which to develop nuclear weapons. But President Obama appears to have stopped listening to the Israeli prime minister, who looks increasingly isolated and indeed faces his own severe criticism at home as a result.

In fact, the deal brings back into the international fold a country without which solutions in the Middle East are hard to envisage, and at a crucial time.

Tehran plays a key role in Syria, through its support for Syrian president Bashar al-Assad, whose regime it has bolstered with military and financial aid. It has also been a key ally of the Hezbollah movement in Lebanon, which has a crucial role in helping Assad defend Syria against its enemies, including the group calling itself Islamic State.

Despite reservations about the Syrian regime, that country's future will be crucial to the international battle against IS and in any future negotiations about Syria, dialogue with Iran is likely to make such negotiations far more fruitful.

The nuclear deal, thrashed out over 17 consecutive days of talks, is not perfect. Tehran's compliance will need to be carefully monitored, as set out in more than 100 pages of detail.

Meanwhile for President Obama, the road ahead is rocky and Republicans at home will attempt to veto the plan. With a presidential election looming, this diplomatic success may come at a political cost. But it is a hugely significant achievement and a very welcome one.