Vladimir Putin met the Iranian president, Hassan Rouhani, on Sunday at the close of a dramatic week in which each had been threatened with punishing economic sanctions by the US.

But they were not meeting to publicly agree a united response to the act of “economic warfare”, as Russia described the sanctions. The two presidents were in the small Kazakh coastal city of Aktau to sign a legal convention on the Caspian Sea.

After more than 20 years of fraught diplomatic efforts, the five littoral Caspian nations – Russia, Iran, Kazakhstan, Azerbaijan and Turkmenistan – agreed upon a legal framework for sharing the world’s largest inland body of water, which bridges Asia and Europe and has reserves of oil and gas as well as being a habitat for sturgeon.

Diplomats described the document as a regional constitution.

Putin told a room where presidents and foreign ministers were present: “Our summit is exceptional if not truly epoch making.”

Rouhani was more circumspect: “Today we have taken a very important step but we should recognise there are more important issues that need to be addressed.” He thanked his Caspian partners for their support since the withdrawal by the US from the nuclear deal known as the joint comprehensive plan of action.

This was a hard-won diplomatic victory. As late as last week Iranian analysts reported that Tehran was “50:50” on whether to sign. The main sticking point was how to apportion the seabed. Many favour division by a line equidistant from the five coastlines, but Iran – with the smallest coastline – does not.

Russia was reluctant to allow Turkmenistan to pursue its proposed 300km gas pipeline to Azerbaijan, which would open up its huge, cheap, gas reserves to a European market at present dominated by Gazprom.

The solution, it seems, has been to keep the wording vague and delay divisive decisions. On Sunday the five nations agreed to 15 miles of sovereign waters, in addition to a further 10 nautical miles of fishing area, beyond which there would be common waters.

“What does this mean? Who knows,” one delegate told the Guardian. “The lawyers will have to tell you.”

The thorny issue of how to split up the hydrocarbon-rich subsoil territory has been put off. Reading from the convention document, Kairat Abdrakhmanov, the Kazakh foreign minister, told the press: “The methodology for establishing state base lines shall be determined in a separate agreement among all the parties according to this convention on the legal status of the Caspian Sea. This is a key phrase, especially important for our Iranian partners.”

The Caspian Sea, which was once controlled by Iran, is a sensitive issue for that country. It lost the northern part of the sea in a defeat by Russia in the 1820s and the loss seems still traumatic. Rouhani’s critics will paint any perceived concession at the summit as national betrayal.

But Rouhani is not well placed to quibble with his neighbours. Since the US president, Donald Trump, issued his twitter threat to unleash “the most biting sanctions ever imposed” on Iran with a promise that “anyone doing business with Iran will not be doing business with the United States”, Tehran has been scrambling to fill dangerous new holes in its economy.

Its preference has long been to reach for trade and diplomatic partnerships in Europe but now the US has effectively cut this market off, Iran has been forced to turn to Russia, China and its regional allies to keep its economy afloat.

Asked if they feared sanctions on the two big regional players would undermine the Caspian’s trading potential, Aktau delegates responded with wait-and-see pragmatism.

“We will have to look into this issue, but for us Iran is an opportunity. It’s a huge country and a huge market. We should not miss this opportunity of cooperating with them,” said a senior Kazakh diplomat. “Iran is our neighbour and our inevitable partner.”

Trump’s goal to reduce Iranian oil sales to zero by November is looking increasingly implausible. On Friday, Iran’s biggest oil customer, China, said it would keep doing business with Iran. Rouhani would have used his bilateral meeting with Putin on the sidelines of the summit to seek similar assurances.

“Putin and Rouhani have very good personal relations. They understand each other,” Stanislav Pritchin, a political analyst and Caspian Sea expert said. “They will discuss sanctions and how to deal with the new circumstances – also the Syrian situation, especially Israel’s attempts to force Iranian troops from Syrian territory, which is completely unacceptable for Iran. But the Russian media won’t cover these meetings. The signing of the convention is the real outcome – that is the great success.”

A legally binding convention that prevents Caspian nations from opening their borders to third-party aggressors – such as the US or Nato – or allowing any foreign military presence at all on Caspian waters is a triumph for Putin. For Rouhani, a strategic display of Russian support is more pressing.

Ariane Tabatabai, a political scientist and co-author of Triple Axis, Iran’s relations with Russia and China, said: “Rouhani needs to indicate to [the Iranian] public he’s doing everything he can to address their economic grievances and reassure the population it’s not isolated. That’s been the major talking point for the Iranian government in the past few weeks.

“The best possible outcome for the Iranians will be to walk away with something tangible to take back to Tehran that says we’re doing just fine with or without US sanctions.”

But bound by sanctions of its own Russia has not got much to give in the way of economic lifelines. The best Putin can offer is assistance in developing Iranian gas fields or some form of cooperation between state-owned institutions already blighted by existing sanctions and written off as toxic.

When it comes to substantial reassurances which Rouhani can take back to an anxious Tehran, an awkward alliance with some trade-friendly neighbours might have to do.