Human rights groups have warned of a crackdown on freedom of speech in Morocco as one of the country's few independent journalists prepared to appear in court this week on charges of aiding and abetting terrorism.

Ali Anouzla, the editor of the Arabic news website Lakome, faces up to 20 years in prison if found guilty, in what Amnesty International described as a "worrying setback for freedom of expression".

He was arrested last month after posting an article on the terrorist threat in Morocco which included a link to an al-Qaida video criticizing the wealth of King Mohammed VI and calling for an uprising. He was held in a high-security prison until last Friday, when he was released on bail before a court hearing on Wednesday.

Anouzla is charged with providing material support to, and apologizing for, terrorism, but his supporters say these claims are a gross distortion of the truth. His colleague, and long-term campaigner for freedom of speech, Aboubakr Jamaï, told the Guardian: "The state is using all its resources to put an independent journalist in prison on horrific charges in order to destroy his reputation and that of Lakome."

The editor has remained silent since being released on bail, when he was greeted by a small gathering of friends and supporters, but his lawyer said that he continued to maintain his innocence.

Morocco's relative calm and popularity as a tourist destination have earned it a reputation as a beacon of stability in north Africa, but critics say this belies rampant corruption, chronic unemployment and a growing disparity between a gilded elite and a largely illiterate poor.

Jamaï said it suffered from the "curse of the bad neighborhood", because the bloody uprisings in Egypt, Tunisia and Syria have allowed the king to present himself as leading the fight against Islamist extremism, while cracking down on his opponents and buying off the elite to keep them on side. He added that Anouzla's arrest "sent a clear message to the rest of the press as to what would happen to them" if they dared to investigate the monarchy, the country's much-criticized policy in the western Sahara, or the under-reported Islamist threat.

This year, Reporters Without Borders ranked Morocco 136th out of 179 countries in its annual Freedom Index, three places behind Zimbabwe. The group has called for charges against Anouzla to be dropped.

"The Anouzla case shows that the judicial system is entirely under the orders of the monarchy. Rather than being the protectors of freedom, many judges serving the regime are its gravediggers," wrote Columbia university professor Youssef Belal .

This message was reinforced at a packed press conference in Rabat last week, where Khadija Ryadi, head of the Moroccan Association of Human Rights, called for "all the charges [against Anouzla] to be dropped because we are convinced of his innocence. This is not just for Ali ... we are fighting for freedom for all". In a move that earned him the admiration of many of Morocco's pro-democracy activists, Jamaï flew in to Rabat from self-enforced exile to lead the campaign for Anouzla's release, despite fears he too would be arrested.

Lakome is at the forefront of an expansion of online news media in Morocco, regularly falling foul of the authorities for its investigative journalism, which has covered the king's botched handling of the release of a Spanish pedophile from prison, his lavish holidays to France, and corruption among his inner circle.

Jamaï said he feared the harassment of Anouzla represented an attempt to "destroy an emerging business model" for web-based journalism which is much harder to control than traditional print media.

Lakome's Arabic and French sites reach an estimated three million users. Its servers are based in Canada, while Anouzla stayed in Morocco as its Arabic-language editor. "With the cost base for online journalism low compared to print, we are hoping to exist with little need for advertising," he has said.

But Mehdi Bensaid, of the Authenticity and Modernity party, which was created by the king's closest adviser, said the real problem was a lack of press regulation. "Morocco can't allow a website to show a 45-minute video praising terrorism, when it will be seen by many people. The [al-Qaida] video was shown without any editing or commentary to contextualize it. This is unacceptable. I am thinking of the one in a million people who see it who may believe that terrorism is the answer."

While the country has largely avoided the Islamist-led violence that has erupted across the region, foreign intelligence services are concerned by the growing number of Moroccans who have gone to fight in Syria.

"Morocco is threatened by al-Qaida like many other countries, and we need to be careful on our borders, with weapons coming in from Libya and Mali," said Bensaid. "We should have freedom of the press, but we have to balance that against the terrorist threat."

But others believe that, in curbing the press, the authorities are merely shooting the messenger. "The real measure of freedom of the press is editorial diversity," said Jamaï, adding that it was almost impossible to investigate the power of the king, and that very few reporters even tried. According to Forbes, Mohammed VI has personal holdings worth around $2.5 billion, with eight palaces, numerous vast estates, and is by far the biggest player in the Moroccan stock market, in a country where the average income is less than $5,000.

Following protests in 2011 that saw tens of thousands take to the streets during the early days of the Arab spring, the king introduced limited reforms in an attempt to prevent the kind of uprisings that saw the fall of Zine al-Abidine Ben Ali in Tunisia and Hosni Mubarak in Egypt. In a much-heralded speech in June 2011, he proposed sweeping constitutional reforms, and new guarantees of human rights.

The Islamist Justice and Development party won the first ever free elections, held that year. But the king has maintained a tight grip on power, and remains the head of the council of ministers, the Ulama council, as well as running the military, security forces and intelligence service. This month, when one of the parties pulled out of the governing coalition, he placed allies in posts at the interior, finance and foreign ministries, reminding everyone of his ultimate authority.

Additional reporting by Aida Alami © Guardian News and Media 2013