Morocco has withdrawn accreditation from a journalist working for the French news agency, AFP, after he wrote an article linking the palace to a political party competing in by-elections.

The official statement carried by the state news agency Friday described the AFP story as "unprofessional" for carrying allegations that the institution of the monarchy was involved in elections.

The journalist, Moroccan national Omar Brouksy, has worked for AFP since 2009. He was beaten by police while covering a small protest in August and was previously the editor-in-chief of a French-language weekly shut down by the state.

There is a degree of media freedom in Morocco but criticism of the palace or the country's policies in the annexed territories of the Western Sahara are considered off-limit topics.