"Fake news" designed to harm Qatar's relations with the U.S. played a major role in the diplomatic split between the tiny Gulf nation and its neighbors, say both U.S. officials and the Qatari government.

In a statement to NBC News, the Qatari government said it had been victimized by a "well-coordinated smear campaign designed to damage the image and reputation of Qatar. And the smear campaign, in turn, set the stage for the blockade and the ultimatum that followed in June."

At the center of the dispute between Qatar and other Gulf states, including Saudi Arabia and the United Arab Emirates, are reports that that the Qatari emir had praised Hamas and called Iran "an Islamic power," and that Qatar had paid nearly a billion dollars in ransom to al Qaeda for the release of a Qatari hunting party.

Both stories are false and apparently planted, say senior U.S. officials.

Read the Full Qatari Statement

In the most recent case, a U.S. intelligence official said that the quotes attributed to Qatar's ruler were phony and part of a campaign to hurt Qatar. Several officials confirmed the report in the Washington Post that someone working for the United Arab Emirates government hacked into Qatari news sites and social media on May 24 to plant the false comments attributed to Emir Sheikh Tamim Bin Hamad al-Thani.

The intelligence official said the operatives who carried out the hack may have been private contractors, but U.S. authorities sees the UAE as ultimately responsible.

The Qatari statement to NBC News said that logs of traffic to the Qatari News Agency's website "show a spike in visits from the UAE during the hour before the hacking incident occurred, which suggests that people in the UAE were clearly anticipating the appearance of the hacked material. Once the fabricated quotes appeared, they immediately became big news in the UAE and Saudi Arabia."

Related: Who's Funding ISIS? Wealthy Gulf 'Angel Investors'

The Post reported that the U.S. had overheard UAE officials discussing the plan on May 23. The next day, the Qatari emir's purported remarks spread via social media, leading the UAE and five of its neighbors to break relations with Qatar, and then block air, truck and ship traffic to the country. The blockade has now been in place for more than a month.

Related: Egypt, Saudi Arabia Among States Cutting Ties to Qatar

The UAE embassy in Washington has denied the allegations in a statement posted on its website.

"The Post story is false," said the statement. "The UAE had no role whatsoever in the alleged hacking described in the article."

"What is true is Qatar's behavior. Funding, supporting, and enabling extremists from the Taliban to Hamas and Qadafi, inciting violence, encouraging radicalization, and undermining the stability of its neighbors."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The statement was signed by UAE ambassador to the United States Yousef Al Otaiba.

According to the Qataris, the Qatari government sent notices to all regional broadcasters and media outlets within 45 minutes saying the news agency's site had been hacked and the emir's quotes were fabricated. "These corrections were promptly acknowledged everywhere except the UAE and Saudi Arabia, where media outlets continued to cite the fake quotes."

"The fake quotes and tweets were then used as a pretext for the luanching of an economic, political and social blockade of Qatar on June 5, and the contents of the fabricated quotes provided the source material for the 13 'non-negotiable' demands that were lodged against Qatar on June 23."

The Qataris also said that prior to the hack, Qatar had received little coverage in the U.S. "That changed in late April when a series of 13 anti-Qatar op-eds appeared over a six-week period in a variety of mainstream and on-line print publications."

Separately, NBC News has found, Qatar was the target of another fake news story a week after the May hack. In this case, there were reports that the Qatari government had paid a ransom, perhaps as much as $1 billion, to al Qaeda-linked terrorists and an Iranian-linked militia in April to gain the release of a group of royals who had been kidnapped on a hunting trip to southern Iraq in late 2015.

The purported ransom, according to regional news media, was highlighted as another example of how Qatar was supporting and financing terrorism. The media cited "militant groups" and "government officials in the region" as sources for the ransom tale. At least one major international publication picked up the story.

According to three U.S. intelligence officials, the ransom story is simply not true. In the words of one, "Hardly anything about the Qatari (ransom) story in the news media is correct."

Related: Behind the Split Between Qatar and Its Neighbors

The two others told NBC News that they would "steer you away" from the idea that al Qaeda received any money. Instead, the ransom was given to the Iraqi government, which had secured the captives' release. The Iraqis kept the money instead of giving it to the kidnappers, according to one of the officials.

None of the three officials were willing to portray the fake ransom story as the work of the UAE or any of the other countries blockading Qatar, but didn't dispute it could be part of a broader effort to discredit the country.

Related: Iran Sees Opening in Saudi-Qatar Feud, Offers Food, Airspace to Qatar

The story began on December 16, 2015 when a group of 27 Qatari nationals were grabbed by bandits while on a hunting trip in southern Iraq.

Although local media called the group a "royal hunting party," one of the U.S. intelligence officials said only one hunter was a royal and described him as a "minor prince." As often happens in the region, the bandits "sold" the group to a Shia militia group in Iraq's Muthanna Province, northwest of Kuwait, where they were held.

Qatar's Emir Sheikh Tamim Bin Hamad Al-Thani and President Donald Trump meet at a hotel in Riyadh on May 21, 2017. Mandel Ngan / AFP - Getty Images file

The Qatari government approached the Iraqi government and negotiations began, said a senior U.S. official. Iraq told the Qataris they had no control over the militia, but said the hostages were being treated well and had been supplied with food and other amenities, including air-conditioning.

The Iraqi government, according to one of the three officials, passed an initial ransom offer to the Qataris, who rejected it in the spring of 2016.

Tensions between the two countries flared amidst the negotiations. In March, Iraq shut down Al Jazeera's Baghdad channel. Al Jazeera is owned by the Qatari government.

Finally, after another round of talks, the kidnapping was resolved. On April 15, a chartered Qatari Airlines plane landed at Baghdad International Airport, loaded not with a billion dollars, but 300 million euros, about $330 million U.S. at the mid-April exchange rate.

Six days later, after almost a year and a half of captivity, the hostages were released and flown back to Qatar on the same plane that brought the cash to Baghdad.

The Qataris never spoke to the kidnappers. The Iraqi government did all the talking, the three U.S. officials agreed, and took custody of the $330 million in euros when it was delivered to Baghdad.

In an April press conference, and in a speech to parliament, Iraqi Prime Minister Haidar al-Abadi congratulated Iraqi security services for their work in resolving the kidnapping. The prime minister said the money had been intended for terrorists, but Iraqi authorities had confiscated it.

And that's where the money remains. Despite the claims that would later circulate in regional media that terrorist kidnappers had received the ransom, two of the U.S. officials say the money is still in Iraqi coffers.

In a statement to Al Jazeera following the release, Qatari officials denied any money was ever intended for terrorists.

The Qatari said the money "was to support the authorities" in Iraq for the release of "abductees."

"Qatar has provided funds to Iraq in an official, clear and public manner," said the statement to Al Jazeera, "Qatar did not deal with armed groups outside the authority of the Iraqi state."

In its statement to NBC News, the Qatari government noted that on June 21, Iraqi Prime Minister al-Abadi had said that the bills delivered to Iraq were not unpacked. "Not one dollar, or euro ... was spent," the Qataris quoted al-Abadi as saying, "they are still in their crates, supervised by a committee.

The Qataris accused the governments of Saudi Arabia and the UAE of ignoring "this clarification and have continued to report 'fake news' about the hostages' release. And regrettably, some legitimate, mainstream news organizations have continued to do the same."