RABAT, Morocco — A few weeks shy of his 15th anniversary as Morocco’s ruler, King Mohammed VI was spotted on the streets of Tunisia in jeans and a T-shirt while on an official visit, living up to the King of Cool nickname given to him by the foreign news media.

Back in the kingdom, however, tensions have been rising. Pro-democracy activists and journalists have faced increasing repression, as the government tries to tame an opposition emboldened by the 2011 Arab revolutions.

One journalist, Ali Anouzla, is risking up to 20 years in jail on charges of promoting terrorism for reporting on a video that is thought to have been made by a militant group, Al Qaeda in the Islamic Maghreb. The video attacked the monarchy and called for jihad in Morocco.

Another journalist, Mustapha Hassnaoui, is serving a four-year sentence for what the government said were his connections with jihadists in Syria. Mr. Hassnaoui started a hunger strike in late May to protest his detention.