Morocco has struggled to cope with a rising tide of sub-Saharan Africans heading to its northern shores in their desperate quest to cross the Mediterranean, and its security forces have increasingly come under fire for beating, arbitrarily detaining and deporting illegal immigrants.
Rabat launched an operation in January to regularise the situation of migrants and grant them residency permits, in the face of allegations that several of them had died at the hands of the police last year.
But HRW said, in a 79-page report launched in Rabat, that despite some improvement since the new migration policy was announced in September, the security forces "commonly beat, otherwise abuse and sometimes steal" from sub-Saharan migrants.
"Morocco should make clear to its security forces that migrants have rights," said HRW refugee program director Bill Frelick, urging Rabat to introduce "firm procedures" to ensure those rights are respected.
HRW also criticised the Spanish security forces for using "excessive force when they summarily expel migrants" from their north African territories of Ceuta and Melilla, Europe's only land borders with Africa.
"(Spain's expulsion of illegal immigrants violates) international and European Union (EU) law, which prohibit countries from forcibly returning anyone to a place where they would face a real risk of being subjected to inhuman and degrading treatment," the report said.
"Spanish authorities should also ensure diligent investigations of allegations of excessive use of force by its own forces... against migrants."
On Thursday, nine sub-Saharans, including one women, drowned while trying to swim to Ceuta, after hundreds of migrants headed out to sea from the Moroccan town of Fnideq.
Spanish media and rights groups cited migrants alleging that police fired into the sea where the Africans were swimming as Moroccan and Spanish security forces tried to repel them from Ceuta.
But the Spanish authorities denied the allegation, saying that civil guards in Ceuta did use rubber bullets to ward off the migrants but fired into the air and did not target anyone directly.
"We did not use anti-riot equipment when the immigrants were in the water," said the head of the Spanish government's delegation in Ceuta, Francisco Antonio Gonzalez.