MADRID — Largely peaceful protests in several Spanish cities descended into chaos and clashes on Wednesday after the police arrested a popular rapper, Pablo Hasél, who had barricaded himself inside a university to avoid a prison sentence for glorifying terrorism and denigrating the monarchy in tweets and lyrics.
Mr. Hasél, 32, was arrested on Tuesday in his home city of Lleida, in the northeastern region of Catalonia, and the demonstrations opposing his incarceration swelled in size Wednesday night as protesters gathered in Madrid, Barcelona and other cities.
What started with people chanting for the rapper’s release turned violent as some protesters hurled bottles and set fires as officers rushed in with batons and fired rubber bullets to disperse the crowds.
The conviction and arrest of Mr. Hasél have set off a national debate over Spanish regulations on speech, which are some of the most restrictive on language deemed dangerous to state institutions.
After Mr. Hasél’s conviction, the national left-wing coalition government said it planned to overhaul parts of the criminal code.
Mr. Hasél’s original two-year sentence was reduced to nine months. But the fact that an artist could be imprisoned over the lyrics of a song or comments on Twitter has galvanized Spain’s artistic community.
More than 200 prominent Spanish writers and artists signed a petition defending Mr. Hasél and warning that Spain’s current law was a threat to “all public personalities who dare to openly criticize the actions of state institutions.”
Protests over Mr. Hasél’s arrest began on Tuesday, when thousands of people took to the streets in Barcelona and other cities in Catalonia to demand his release.
The demonstrations continued on Wednesday and expanded to Madrid, the capital, and other cities.
The Spanish police detained 19 people in Madrid and 29 in Catalonia on Wednesday, according to local news reports. Protesters were seen throwing stones and other objects at the police, smashing windows and setting trash cans on fire.
Journalists at the scene posted images and videos on social media showing large crowds of protesters, many of them wearing surgical masks, squaring off against police officers in riot gear.
“Pablo, comrade, you are not alone,” one crowd chanted on Wednesday in Lleida, the Catalan city where Mr. Hasél was arrested.
The authorities in Madrid said on Wednesday that access to a central train station had been restricted as a result of disturbances to “public order.”
Police officers and mostly young demonstrators also clashed around Puerta del Sol, a main square in Madrid, as some protesters who sought to reach the Parliament building were stopped by the police. Five officers suffered minor injuries in the clashes in Madrid, according to Europa Press, a Spanish news agency.
A Reuters journalist in Barcelona was among those injured when officers fired rubber bullets into a crowd, the news agency reported. Protests also took place other Spanish cities, including Granada, where four demonstrators were detained, according to local news outlets.
Mr. Hasél, whose real name is Pablo Rivadulla Duró, was a popular provocateur well before he was sentenced to prison in 2018.
He has accused the Spanish police of brutality, compared judges to Nazis and expressed support for ETA, a Basque separatist group that dissolved two years ago after waging one of modern Europe’s longest terrorism campaigns.
In 2018, Spain’s High Court sentenced Mr. Hasél to just over two years in prison for glorifying terrorism and insulting the monarchy. The charges focused on his incendiary tweets and a song he had written about King Juan Carlos, who abdicated in 2014. A judge later reduced the sentence to nine months.
Last month, Mr. Hasél was ordered to report to prison by mid-February.
The public pressure led the Justice Ministry to say on Monday that it planned to change the country’s criminal code to reduce sentences related to the kinds of speech violations for which Mr. Hasél was sentenced. The ministry did not provide specifics about its plan.
Mr. Hasél was arrested on Tuesday after he and about 50 supporters barricaded themselves inside a building at Lleida University.
“They will never silence us!” he yelled to reporters as the police led him to a patrol car, the newspaper El País reported. “Death to the fascist state!”
In his last Twitter message before he was incarcerated, Mr. Hasél issued a warning to his supporters.
“Tomorrow it can be you,” he wrote.
Spain has a history of sentencing people for comments made on social media, based mostly on its law that forbids the glorification of terrorism.
Some of these sentences have been handed down against young and unknown social media users, but others have targeted more prominent figures.
A Spanish rapper known as Valtònyc fled to Belgium in 2018 after getting a prison sentence for writing song lyrics that a court found glorified terrorism and insulted the monarchy.
The rapper, whose real name is Josep Miquel Arenas, has since been fighting Spain’s efforts to extradite him from Belgium.
Mr. Hasél’s supporters include some Spanish politicians, the director Pedro Almodóvar and the movie star Javier Bardem. Amnesty International called his arrest “an excessive and disproportionate restriction on his freedom of expression.”
“No one should face criminal prosecution only for expressing themselves on social media or for singing something that may be distasteful or shocking,” Esteban Beltrán, the director of Amnesty International Spain, said in a statement hours before Mr. Hasél’s arrest. “Expressions that do not clearly and directly incite violence cannot be criminalized.”
But the rapper’s legal troubles could continue for some time.
Mr. Hasél’s nine-month term may be lengthened to more than two years because he has refused to pay fines associated with his sentence.
The police are also investigating him over alleged efforts to break into a government building in Lleida during a protest two years ago over the detention in Germany of Carles Puigdemont, the former leader of Catalonia.
Raphael Minder reported from Madrid, and Mike Ives from Hong Kong.