(CNN) Qatar made a series of secret agreements with its Gulf neighbors in 2013 and 2014 barring support for opposition and hostile groups in those nations, as well as in Egypt and Yemen.

The existence of the agreements has been known, but both the content and the documents themselves were kept secret due to the sensitivity of the issues involved and the fact that they were agreed in private by heads of state. The agreements were exclusively obtained by CNN from a source from the region with access to the documents.

The Gulf countries have accused Qatar of not complying with the two agreements, which helps explain what sparked the worst diplomatic crisis in the Middle East in decades.

Abiding by the agreements was among six principles the Gulf nations set as requirements to mend relations with Qatar in a statement released last week.

In a statement to CNN, Qatar accused Saudi Arabia and UAE of breaking the spirit of the agreement and indulging in an "unprovoked attack on Qatar's sovereignty."

The first agreement -- handwritten and dated November 23, 2013 -- is signed by the King of Saudi Arabia, the Emir of Qatar and the Emir of Kuwait. It lays out commitments to avoid any interference in the internal affairs of other Gulf nations, including barring financial or political support to "deviant" groups, which is used to describe anti-government activist groups.

The agreement, referred to as the Riyadh agreement, specifically mentions not supporting the Muslim Brotherhood, which the Gulf allies have repeatedly alleged Qatar supports , as well as not backing opposition groups in Yemen that could threaten neighboring countries.

Contents of agreements

In justifying their boycott launched last month, Qatar's Gulf counterparts accuse Doha of financially supporting Hezbollah and other terror groups, in addition to backing the Muslim Brotherhood in Egypt.

In the first agreement, the countries also vowed not to support "antagonistic media," an apparent reference to Al Jazeera -- the satellite news station based in Qatar and funded by its government -- which other Gulf states accuse of trumpeting opposition groups in the region including Egypt and Bahrain.

A second agreement headlined "top secret" and dated November 16, 2014, adds the King of Bahrain, the Crown Prince of Abu Dhabi and the Prime Minister of the UAE. It specifically mentions the signatories' commitment to support Egypt's stability, including preventing Al Jazeera from being used as a platform for groups or figures challenging the Egyptian government.

The second agreement specifically mentions Al Jazeera, and not other media outlets like the Saudi-owned Al Arabiya. After the agreement was signed, Al Jazeera had shut down a channel dedicated to coverage: Al-Jazeera Mubashir Misr.

A supplemental document to the 2013 agreement signed by the countries' foreign ministers discusses implementation of the agreement.

It includes provisions barring support of the Muslim Brotherhood, as well as outside groups in Yemen and Saudi Arabia that pose a threat to security and stability of Gulf Cooperation Council countries, a six-nation group that includes Saudi Arabia, the UAE, Bahrain and Qatar.

The agreements do not single out Qatar, as the provisions included apply to all countries who signed it.

Qatar: Demands 'bear no relation' to prior agreements

In response to CNN questions, a Qatari spokesman said in a statement that it was Saudi Arabia and the UAE who "have broken the spirit of the agreement."

"A full reading of that text will show that the intent of the 2013/14 agreements was to ensure that sovereign GCC nations be able cooperate within a clear framework," said Sheikh Saif Bin Ahmed Al-Thani, director of Qatar's government communication office.

"Their demands -- that Qatar close down Al Jazeera, force the breakup of families, and pay 'compensation' -- are demands that bear no relation to the Riyadh agreements," he added. "Further, at no point did Saudi Arabia or the UAE use the mechanisms in the Riyadh agreement to communicate their concerns to Qatar."

Al-Thani said that the current list of demands put to Qatar "represent an unwarranted and unprecedented attack on Qatar's sovereignty, and it is for that reason that they have been rejected by Qatar and condemned by the international community."

"This crisis was triggered by a hacking, fabricated statements, and a coordinated media campaign against Qatar," he said. "From the beginning, Saudi Arabia and the UAE have attempted to conceal facts from the general public, including their own citizens, going so far as to block Al Jazeera and other media outlets within their borders."

Quartet: Demands 'in line with the spirit' of agreements

After CNN's story published, Saudi Arabia, the UAE, Bahrain and Egypt issued a joint statement Monday saying the documents "confirm beyond any doubt Qatar's failure to meet its commitments and its full violation of its pledges."

"The four states emphasize that the 13 demands submitted to the Qatari government were to fulfill their previous pledges and commitments and that the demands were originally stated in the Riyadh Agreement, its mechanism and the Supplementary Agreement and are fully in line with the spirit of what was agreed upon," the countries stated.

Qatar responded with a statement from Al-Thani that argued the demands issued last month "bore no relation to the Riyadh agreements."

The documents from 2013 and 2014 hint at longstanding tensions between the countries in the GCC.

In March 2014, for instance, Saudi Arabia, the UAE and Bahrain withdrew their ambassadors from Qatar because they alleged Qatar was not implementing the first agreement's pledge not to interfere in other countries' internal affairs.

The agreements also appear to be an attempt to improve relations. Citing "extensive deliberations in which they conducted a full revision of what taints the relations between the [Gulf Cooperation] Council states," the first agreement states that the parties agreed to "abolish whatever muddies the relations."

But the agreements also provide new insight to help explain why nine Middle Eastern countries, led by Saudi Arabia, cut ties with Qatar in June over its alleged support of terrorism.

Qatar has called the allegations leveled last month "unjustified" and "baseless."

Qatar claims demands breach international law

Four of the Arab States that boycotted Qatar submitted a list of 13 demands to end the diplomatic crisis, including shuttering Al Jazeera.

The list also included demands to cut ties to extremist organizations, including the Muslim Brotherhood, Hezbollah and ISIS, to halt the development of a Turkish military base in the country and to stop the practice of giving Qatari nationality to their citizens.

Egyptian Foreign Minister Sameh Shoukry said last week that Qatar had responded negatively to the demands, saying Qatar's response was "overall negative and lacked any substance."

Qatari's foreign minister argued some of the demands violated international law.

"If you are looking at the demands -- there are accusations that Qatar is supporting terrorism -- they are shutting free speech, shutting the media outlets, expelling people. ... So there are a lot of demands which are against the international law," Sheikh Mohammed bin Abdulrahman Al Thani told CNN's Christiane Amanpour last week.

JUST WATCHED Qatari FM responds to Saudi Arabia demands Replay More Videos ... MUST WATCH Qatari FM responds to Saudi Arabia demands 10:20

US diplomacy

Trump administration officials are hoping they can help broker a resolution to the diplomatic crisis. Secretary of State Rex Tillerson is going to Qatar and Saudi Arabia this week as part of his trip through the region. On Monday, he met with officials in Turkey -- allied with Qatar in the dispute -- and Kuwait, which is playing a mediator role.

He also met with Kuwait's Acting Prime Minister and Foreign Minister Sheikh Sabah Khaled Al-Hamad Al-Sabah and British National Security Adviser Mark Sedwill in Kuwait Monday. The three countries issued a joint statement expressing concern and calling for a rapid end to the crisis through dialogue, according to Kuwait state media.

R.C. Hammond, a State Department spokesman, said the purpose of Tillerson's trip was "to explore the art of the possible of where a resolution can be found," and the US was "looking for areas of common ground where a resolution can stand."

"We've had one round of exchanges and dialogue and didn't advance the ball," Hammond told reporters. "We will work with Kuwait and see if we can hash out a different strategy. ... This is a two-way street. There are no clean hands."

President Donald Trump also spoke last week to the leaders of Qatar, the UAE and Saudi Arabia.

When the Gulf countries first cut ties with Qatar, however, Trump appeared to support the Gulf countries cutting ties with Qatar, saying that Doha had to stop funding terrorism . Trump's comments came following his visit to Saudi Arabia on his first foreign trip as president, and contradicted his secretary of state.

UPDATE: This story has been edited for clarity and to add the text of the supplemental agreement signed by countries' foreign ministers.