During King Salman of Saudi Arabia's five-day visit to Egypt that concluded Monday, the two Arab countries made a number of agreements that have drawn a range of reactions from the offline and online communities.

These agreements included Saudi Arabia signing a $1.5 billion investment for housing in Sinai, agreeing to finance five years' worth of Egypt's petroleum needs at an optimal two percent interest rate and a landmark agreement to build a bridge over the Red Sea to connect the two countries.

However, it was the agreement to transfer Egypt's control over the Red Sea islands, Tiran and Sanafir, back to Saudi Arabia that drew the most controversy.

Tiran and Sanafir, which strategically lie on the sea route to the port of Jordan's Aqaba and others, were originally under Saudi control.

Expecting trouble during the turbulent years of the Arab-Israeli conflict, Saudi Arabia asked Egypt to protect them from Israeli invasion, a request Egypt agreed to by sending its troops in the 1950s.

Israel did in fact attack and occupy the islands in 1967, it then evacuated them in 1982 because of the agreements outlined in the peace treaty with Egypt.

Despite the fact that the two islands don't legally fall under Egyptian sovereignty but are administered by Egypt, and that Saudi Arabia had been negotiating to gain back control over them for years, the deal came under fire from various perspectives.

Most of the anger expressed from Egyptians online came from their view that the two islands were national territories that were being sold in return for political and economic gains, while others said that it was unconstitutional to give up sovereign land without holding a national referendum.

"Every country that wants a piece of the cake can come and take it, the important thing is whether it will pay in euros, dollars, Saudi riyals or by shekel," wrote one Egyptian Twitter user sarcastically.

"Egyptian public opinion refuses to give up Tiran and Sanafir to Saudi Arabia in return for its support, they are pure Egyptian islands and the sons of the army paid their price with their lives during the war," wrote another.

On the other hand, many Saudis online affirmed that the two islands had always been Saudi territories and that they were only under Egyptian guardianship, with many of them sharing recently released photos of official documents proving Saudi sovereignty over the islands.

"The only evidence our brothers the Egyptians have to prove that the islands belong to Egypt is a sixth grade textbook," wrote one Saudi Twitter user, commenting on the fact Tiran and Sanafir are called Egyptian islands in Egypt's primary school textbooks.

Due to their strategic significance, the sovereignty status of Tiran and Sanafir has been a matter of debate long before the current Saudi-Egypt deal.

Late Egyptian president Gamal Abd El-Nasser claimed the islands were Egyptian after Egyptian troops took control of them, this led to generations of Egyptians being taught in school textbooks that they were Egyptian, while generations of Saudis were being told the opposite. The years of Arab-Israeli turmoil only added to the confusion.

The Saudi foreign minister Adel Al-Jubeir said that Egypt didn't occupy the two islands but entered them due to Saudi Arabia's request, adding that documents of the two countries don't show "any disagreement on the Saudi identity of both islands."

Egyptian international law expert Moufid Shehab said that it is the long period of Egyptian guardianship over the two islands that has led to people considering them to be Egyptian.

Shehab, who was part of the legal team that successfully negotiated with Israel for the return of Sinai's Taba, added that possession guarantees ownership under private law but not under international law. He compared the situation to Egypt's control over the Gaza strip from 1948 to 1967, saying it didn't mean Gaza fell under Egyptian sovereignty.

The agreement is yet to be voted on in the Egyptian Parliament.