Image copyright Getty Images Image caption The world's largest inland body of water is bounded by Iran, Russia, Kazakhstan, Turkmenistan and Azerbaijan

It is a landmark deal that has been more than two decades in the making.

Russia, Iran, Azerbaijan, Kazakhstan and Turkmenistan - all bordering the Caspian Sea - have agreed in principle on how to divide it up.

Their leaders signed the Convention on the Legal Status of the Caspian Sea in the Kazakh city of Aktau on Sunday.

It establishes a formula for dividing up its resources and prevents other powers from setting up a military presence there.

It is an important step in the easing of regional tensions, but the deal over the world's largest inland body of water matters for several reasons.

Here's what you need to know about the hotly disputed Caspian Sea.

1. Its legal status has been complicated

It would be reasonable to assume that the Caspian Sea is, well, a sea. But at the heart of this long-running dispute is whether or not the 370,000 sq km (143,000 sq mile) body of landlocked water should be considered a lake.

Until the dissolution of the Soviet Union (USSR) in 1991, that's what it was known as and shared between the USSR and Iran.

But the arrival on the scene of new countries complicated this issue, with ensuing claim and counterclaim.

Iran had argued it was a lake and not a sea, but none of the four other countries agreed.

Why is the difference so important?

If it was treated as a sea, then it would be covered by international maritime law, namely the United Nations Law of the Sea.

This binding document sets rules on how countries can use the world's oceans. It covers areas such as the management of natural resources, territorial rights, and the environment. And it is not limited to littoral states, meaning others can seek access to its resources.

But if it is defined as a lake, then it would have to be divided equally between all five countries.

Sunday's agreement goes some way to settling this dispute.

The signed convention gives the body of water a "special legal status" which means it is not defined as a sea or a lake, Russian officials said.

The surface water will be in common usage, meaning freedom of access for all littoral states beyond territorial waters.

But the seabed - which is rich in natural resources - will be divided up.

2. Who wins and who loses?

It's difficult to say, as the final text of the deal is yet to be published.

Another key factor is that seabed boundaries are yet to be negotiated (although now it's the subject of bilateral agreements - not multilateral as before).

But because the deal does not define the Caspian as a lake, Iran - which has the smallest coastline - is viewed as a potential loser.

Iranian social media users have accused the government in Tehran of "selling off" the Caspian Sea on Sunday.

Image copyright Getty Images Image caption Iran's Caspian coast - does Iran lose out?

However, Iran - which is currently under growing political and economic pressure from the West - might see some political benefits in securing the clause that bars any armed presence on the Caspian other than that of the five littoral states.

Had the Caspian been defined as a lake, Azerbaijan and Kazakhstan - who have established an early claim over large areas of the Caspian - stood to lose out under such a split.

So the basis of all previous disagreements stems from who gets access to what. This is important because...

3. It is rich in oil and gas

The Caspian Sea is highly-prized for its vast oil and gas reserves.

It's estimated there are 50 billion barrels of oil and nearly 300 trillion cubic feet (8.4 trillion cubic metres) of natural gas beneath its seabed.

Image copyright AFP Image caption Soviet oil rigs are seen on the shores of the Caspian sea in Azerbaijan

That is why disagreements over how to divide some of its huge oil and gas fields have been numerous - and acrimonious. On occasion, warships have been deployed to scare off contractors hired by rival countries.

The disagreement over its legal status has also prevented a natural gas pipeline being built across the Caspian between Turkmenistan and Azerbaijan. This would have allowed Turkmen gas to bypass Russia on its way to Europe.

Russia - a major exporter of gas and oil to Europe - has previously objected to this.

International oil companies that rushed to the Caspian in the 1990s have now pulled out.

But there is a possibility this could be explored further following Sunday's deal.

4. It provides the world's caviar

The Caspian Sea has a number of different species of sturgeon, the fish that yields the highly prized delicacy caviar.

Between 80-90% of the world's caviar is sourced from the Caspian, but the numbers have been falling over the past few decades.

Image copyright Getty Images Image caption The Caspian Sea is well-known for its population of sturgeon

In 2002, a survey found that the fish was rapidly disappearing and could soon become extinct.

It also found an abnormally large proportion of young sturgeon in comparison to more mature fish which produce the eggs used to make caviar.

In response, various bans on sturgeon fishing in the Caspian Sea and on the caviar trade more generally have been introduced.

Significantly, Kazakh President Nursultan Nazarbayev said on Sunday that the recent agreement allowed the setting of national quotas for fishing.

5. Pollution is a major problem

The Caspian Sea has long suffered pollution from oil extraction and other industries.

Oil pollution has affected the migration routes of sturgeon, according to the UN's Caucasus Environment Outlook.

It says sturgeon swim through highly polluted water near Azerbaijan's Absheron Peninsula - and that is believed to limit their food and oxygen.

Image copyright Getty Images Image caption Oil glistens on the surface of the Caspian Sea

A more recent concern is bacterial pollution caused by sewage from Iran, which is adding to the threats facing sturgeon fish.

The Caspian Sea's disputed legal status was also a risk factor for the environment - as no enforcement would have been possible to deal with a major oil spill or other pollution incident in disputed waters.