Morocco's King Mohammed VI right, and his brother Prince Moulay Rachid. (Abdeljalil Bounhar/Associated Press)

WHAT COULD be a more suitable use of a smartphone than a simple app to help journalists securely and professionally assemble and publish news about their government and their world? That’s what StoryMaker for Android does, and a Dutch nongovernmental organization, Free Press Unlimited, recently trained journalists in Morocco on how to use it. On Thursday, seven people in Morocco went on trial for this exercise in free speech. Five face criminal charges that could result in fines and prison, while the other two face fines.

The five face criminal charges based on a vague Moroccan law that says people are guilty of “harming internal state security” if they receive “support intended, or used, to finance an activity or propaganda capable of harming the integrity, sovereignty or independence of the Kingdom, or shaking the loyalty that citizens owe to the state and institutions of the Moroccan people.” In other words, anyone who criticizes the government or speaks out. The other two face charges of receiving foreign funds for the journalism training without government permission.

Morocco, a kingdom long known for its moderation and stability in the Arab world, adopted constitutional reforms in response to the Arab Spring and has held competitive parliamentary elections. The kingdom is not really a full democracy, but it has avoided the descent into chaos seen elsewhere. Yet the space for free speech and association has narrowed dramatically in the past two years. The authorities have cracked down on civil society, human rights activism and journalists. According to Human Rights Watch, Morocco has applied a “mix of police harassment, unfair trials delivering heavy fines to outspoken journalists and media, and royal-palace-orchestrated advertisement embargoes” to force many independent newspapers to close. The kingdom expelled two Amnesty International researchers in June and asked Human Rights Watch to stop operating in the country. The Moroccan Association of Human Rights has been under pressure, too, with police raids and criminal charges filed against activists.

Those who are being prosecuted in the current proceeding include Maati Monjib, a university professor who has published numerous articles critical of the government and has been repeatedly called in for questioning by the police and told he cannot leave the country. Mr. Monjib, a founder of the nongovernmental group Freedom Now, went on a three-week hunger strike in October to protest his treatment. The others include Hicham Mansouri, project manager at the Moroccan Association for Investigative Journalism; Hisham Almiraat, former president of the Association of Digital Rights; Abdessamad Iyach, a journalist and acting project manager at the investigative journalism group; and Mohamed Saber, president of the Moroccan Association of Youth Education. In addition, Rachid Tarik and Maria Moukrim, president and former president of the investigative journalism group, are in court on charges of receiving foreign funding.

The proceedings should be canceled, the charges dropped and the law revised. That would show that Morocco is truly committed to democracy and tolerance.