Two policemen have reportedly been killed in Azerbaijan's second city, Ganja, following an assassination attempt several days earlier against the mayor.

The government has blamed Islamic extremists for both the assassination attempt and what they called “riots” that led to the officers' deaths, and have suggested that they were abetted by hostile foreign forces. But many details about the events that transpired over the week remain unclear, giving rise to conspiracy theories on all sides.

On July 3, Elmar Valiyev, the mayor of Ganja, was seriously wounded in a shooting attack; both he and his bodyguard were hospitalized. The authorities initially put the blame on “opposition circles” seeking to take advantage of a nationwide electricity blackout.

Elmar Valiyev (center) via CC BY-SA 3.0

A suspect, Yunis Safarov, was quickly arrested on homicide and weapons charges. It was the first assassination attempt on a government official in Azerbaijan in nearly 25 years.

Valiyev was widely hated in Ganja, with a reputation for regularly seizing citizens' homes under bogus pretenses and demolishing them in order to replace them with buildings for government-connected people. And so the attack on him was cautiously supported on Azerbaijani social media. “People didn't like Elmar Valiyev, he was unethical and had no respect for private property,” said Ganja-born Elchin Sadigov, a former opposition politician who co-founded the France-based exile movement Democracy For Azerbaijan.

“Many welcomed this incident [the attack on Valiyev], even though it was a crime, because people didn’t like him,” Bakhtiyar Hajiyev, a Ganja resident and political activist, told Eurasianet.

The day after Safarov was arrested, photos of him were circulated on social media in which he appeared to have been badly beaten, presumably by the police. But the day after that, Safarov was brought before the media for the first time and, despite obvious signs of violence on his face, he claimed that the police had not mistreated him.

Officials put forward a number of theories about Safarov's motivation. Valiyev's brother – also Azerbaijan's chief military prosecutor – claimed that “the suspect's mother is Armenian and he worked for the Russian secret services.”

But on July 6, the government issued a statement claiming that “Safarov's main purpose in committing a terrorist act was to establish an Islamic state governed by Sharia law in Azerbaijan, killing a number of well-known civil servants in the country, creating a scandal, chaos, panic and, ultimately, the forced seizure of power.” The statement said Safarov had spent eight months in Iran in 2016 and had fought in Syria. It also linked Safarov to Taleh Bagirzade, a Shia cleric whose group, Muslim Unity, has been accused by the government of trying to seize power.

Meanwhile, some residents of Ganja were getting text messages from unknown numbers that used religious language and defended Safarov, locals told Eurasianet. A video of a woman purporting to be Safarov's wife was circulated on social media in which she said her husband had “avenged Imam Hussein,” linking him with Shia martyrs.

Other text messages and posts, also from mysterious sources – one significant one was a YouTube channel that was launched only on July 5 – called for a demonstration on July 10 with slogans including “Don't abandon brother Yunis,” “Don't be silent this time,” and “Ganja people will riot, get ready.”

Late on July 10, the authorities announced that two senior police officers were stabbed to death after “a radical religious group of 150-200 people gathered” outside of the Ganja mayor's office “in an attempt to brutally disturb public order.”

"Due to resolute measures taken by police officers, their illegal actions were prevented and 40 people were detained and taken to Ganja City Central Police Department, while the rest escaped the scene," said the statement, issued jointly by the Prosecutor General, the Ministry of Internal Affairs, and the State Security Service.

But there has been little documentation from the scene of the protest, and none indicating any clashes or violence, and the authorities' claims could not be verified.

Azerbaijani officials have offered a variety of theories about the protests. “The events in Ganja showed that the development of Azerbaijan worries not only Armenia, but also some other external forces,” said Foreign Ministry spokesman Hikmet Hajiyev at a briefing on July 11.

While “Azerbaijan is at war, the murder of police officers is a national betrayal,” Hajiyev said. “Traitors of the homeland, living abroad, who welcome and support these actions, should be ashamed.”

A former foreign minister, Tofik Zulfugarov, wrote that “some radical circles in the Iranian leadership are trying to destabilize the situation in Azerbaijan, make it unstable for a long-term period, and cause a clash between Shiite and Sunni in our country.”

And Ali Hasanov, a senior adviser to President Ilham Aliyev, said in a Facebook post that “foreign media and Facebook pages” have been working for more than a year to “create an Islamophobic and anti-Shiite image of” Valiyev, the mayor, to which Safarov apparently fell victim.

Opposition activists expressed skepticism about the authorities' versions of events. After Valiyev's shooting, the police presence in Ganja was ubiquitous, and yet religious activists were apparently able to organize an unsanctioned rally at which two high-ranking police officers were stabbed and died very quickly. “This never happens in Azerbaijan and it raises questions in people’s minds,” said Abulfaz Gurbanli, a board member of the youth activist group N!DA Civic Movement. “Yesterday’s demonstration was not a protest. It was very obvious.”

Hajiyev, the Ganja-resident activist, said the protest appeared to be engineered “to kill the sympathy” for Valiyev's attacker.

In the wake of the attack, and the power outage, 14 people have been arrested because of their social media posts about the events. In a press release the Prosecutor General's Office accused them of "supporting terrorism" and "disrupting socio-political stability" in Azerbaijan, among other offenses. Criminal investigations also were launched against four news websites. Criminal.az and Bastainfo.com were accused of “knowingly spreading false information,” while Topxeber.az and Fia.az stand accused of “spreading unfounded, sensational claims in order to confuse the public.”