Hundreds of police officers and more than 20 civilians have been injured as anti-government protests turned violent in Morocco.