Image copyright BBC/Jonathan Blezard

A year-long political conflict between the tiny, wealthy state of Qatar and its larger neighbours - including Saudi Arabia and the United Arab Emirates - has been fought with a new arsenal of weapons: bots, fake news and hacking.

In the early hours of 24 May 2017, a news story appeared on the website of Qatar's official news agency, QNA, reporting that the country's emir, Sheikh Tamim bin Hamad al-Thani, had made an astonishing speech.

The quotes then appeared on the QNA's social media accounts and on the news ticker running along the bottom of the screen on videos uploaded to the agency's YouTube channel.

The emir was quoted praising Islamist groups Hamas, Hezbollah and the Muslim Brotherhood. And perhaps most controversially of all, Iran, Saudi Arabia's arch-rival.

Image copyright Reuters Image caption Qatari citizens have expressed their support for their emir on murals in Doha

But the story soon disappeared from the QNA website, and Qatar's foreign ministry issued a statement denying the speech had ever taken place. No video footage has ever emerged of the emir actually saying the words supposedly attributed to him.

Qatar claimed that the QNA had been hacked. And they said the hack was designed to deliberately spread fake news about the country's leader and its foreign policies. The Qataris specifically blamed UAE, an allegation later repeated by a Washington Post report which cited US intelligence sources. The UAE categorically denied those reports.

But the story of the emir's speech unleashed a media free-for-all. Within minutes, Saudi and UAE-owned TV networks - Al Arabiya and Sky News Arabia - picked up on the comments attributed to al-Thani. Both networks accused Qatar of funding extremist groups and of destabilising the region.

And soon after there was another alleged hacking - this time, targeted at the UAE. Youssef al-Otaiba, the UAE's ambassador to the US was hacked. His emails were leaked to the press. This led to long, lurid articles about his private life in international media.

The fallout

On 5 June 2017, Saudi Arabia, the United Arab Emirates, Bahrain, Egypt and their allies - nine governments in total - cut ties with Qatar. They expelled Qatari citizens, suspended diplomatic ties, closed Qatar's only land border, shut down their airspace and halted all trade.

Image copyright AFP/Getty Images Image caption Qatar has rejected demands to close Al Jazeera

The self-styled "Anti-terror Quartet", led by Saudi Arabia's new crown prince, Mohammed bin Salman, issued 13 wide-ranging demands for Qatar to meet in 10 days. These included closing down its main TV channel Al Jazeera and ceasing cooperation with Iran.

US President Donald Trump, fresh from his first presidential visit abroad - to Saudi Arabia - welcomed the move in a series of tweets the following day. He said it was evidence of his anti-terror policies in action.

His comments fuelled the propaganda battle that had already begun on Twitter. The platform was flooded with hashtags both for and against Qatar.

Battle of the bots

On the Qatar side, hashtags "Tamim The Glorious" and "Qatar Is Not Alone" appeared on Twitter's homepage in the Gulf, supposedly showing they were popular sentiments for the region's social media users. Meanwhile, The Saudi and UAE side accused Sheikh Tamim of being the "Gaddafi of the Gulf", a reference to the late Libyan leader Muammar Gaddafi.

However, a BBC Arabic investigation has revealed that the majority of tweets using these hashtags were pushed by fake accounts known as "bots". Bots are automated accounts which attempt to manipulate public opinion by artificially boosting the popularity of social media posts.

Ben Nimmo, a senior fellow at the Atlantic Council, took a deep dive into some of the most consistently trending hashtags in the conflict and establish the source of their popularity.

Media playback is unsupported on your device Media caption How to spot a bot

He detected Twitter bots using a number of methods, such as looking for sudden "spikes" in the traffic on a hashtag, which suggests automated posting.

"On #Tamim_The_Glorious, this post by an account @sabaqksa had 201 retweets in the space of a couple of seconds, that's not a normal pattern of behaviour," Nimmo says. The @sabaqksa account has been suspended by Twitter and BBC Arabic has not been able to contact its owner for comment.

Another massive surge of traffic on this hashtag came from one hundred accounts posting 1,410 times in a five hour period. Nimmo says it is "utterly implausible" that human operated accounts would post this frequently.

When a number of bot accounts work together like this, it is called a bot net.

Image copyright Twitter Image caption Twitter bots spread this doctored picture of Qatar's emir

But Nimmo found bots on the anti-Qatar side too, pushing out offensive tweets including images of Qatar's emir as a dog barking orders and another in which he is depicted as cross-eyed.

Many of the anti-Qatar bots seemed to be boosting tweets that were originally posted by one specific account, @saudq1978.

The @saudq1978 account belongs to Saud al-Qahtani, a prominent member of the Saudi Royal Court and advisor to Prince Mohammed bin Salman. With more than a million followers online, he has a significant presence on Twitter.

Image copyright Twiiter/@suadq1978 Image caption Anti-Qatar bots have often spread tweets by this senior Saudi adviser

The top 5 tweets on the "Gaddafi Of The Gulf" hashtag were all from this account, which along with retweets made up 66% of the total traffic. The account accused Qatar of killing people in the Libyan civil war, and blamed it for funding terrorism and extremism.

BBC Arabic made repeated attempts to contact Saud al-Qahtani for comment, but without success.

"Fake news is everywhere"

Meanwhile, the "boycott" or "blockade" of Qatar - depending on which side you talk to - looks unlikely to be over soon, despite recent US efforts at mediation.

Hashtags about the conflict are still trending, and the hacking war has continued well into 2018. And the region's satellite TV channels are still trading accusations.

They have also presented very different pictures of the impact of the crisis on life in Qatar. Al Arabiya, which is owned by Saudi interests, has shown footage of supermarkets with empty shelves. But reports on Al-Jazeera, which is funded by the Qatari state, tend to show people on their streets living their lives as normal.

Image copyright Al Arabiya Image caption Al Arabiya TV reports have suggested Qataris has suffered food shortages

According to Dina Matar, a senior lecturer in Arab media and political communication at SOAS: "It's not only a political battle, it's also a media battle. We have a huge problem in the Arab world just as you do in the West. Fake news is everywhere."

"Arab politicians and leaders are completely aware that the media is important and that the media is an important weapon. It is a weapon for propaganda, a weapon for private and public interests," she says.

Recently, a hashtag which translates as #Anniversary_Of_The_Midnight_Fabrications trended in Qatar. It commemorates the first anniversary of the alleged hacking of the Qatar News Agency. Twelve months on from that original incident there is a little sign of the tensions abating between the two sides.

You may also be interested in:

More on this story

Do you have a story for us? Email BBC Trending.

More from Trending:

Image copyright Getty Images

Political parties in Mexico are using bots and fake accounts in an attempt to influence voter behaviour and in some cases spread false stories ahead of the country's presidential elections on 1 July, according to researchers, journalists and activists. READ NOW

You can follow BBC Trending on Twitter @BBCtrending, and find us on Facebook. All our stories are at bbc.com/trending.