King Mohammed of Morocco has granted a pardon to the country's leading satirical journalist, Ali Lamrabet.
Mr Lamrabet's case had attracted international attention
The pardon comes more than seven months after Mr Lamrabet was jailed on charges of insulting the king and endangering Morocco's territorial integrity.
He had been serving a three-year prison sentence for publishing articles, cartoons and photographs in a weekly magazine which he edited.
He was pardoned along with more than 30 other political detainees.
As owner and editor of several independent magazines, Mr Lamrabet had long been a thorn in the side of the Moroccan authorities.
These publications included the French-language Demain Magazine and the Arabic-language Doumane weeklies.
He was imprisoned in June last year after he published material ridiculing government ministers, questioning the way the royal household budget is allocated and opposing Morocco's policy towards the Western Sahara.
His case had drawn international criticism, particularly from the United States and Spain.
The BBC's Pascale Harter in Morocco says the decision to pardon Mr Lamrabet is seen as a personal gesture by King Mohammed, intended to signal a new chapter in Morocco's human rights and justice record.
During his time in prison, Mr Lamrabet had twice gone on hunger strike to protest against his conviction.
He is expected to be released later on Wednesday.