A court in Spain on Monday suspended the repatriation to Morocco of a group of unaccompanied minors who were among thousands of migrants who crossed into the Spanish enclave of Ceuta three months ago.
Two human rights groups took legal action on their behalf after Spain on Friday began sending back some 800 unaccompanied child migrants to Morocco in groups of 15.
The court ruling may make it difficult for Spain to go ahead with plans to repatriate the roughly 800 unaccompanied minors in their care.
The rights campaigners had asked a court in Ceuta to stop the deportation of 12 migrants who had sought their help to stay.
The migrant children were being deported to Morocco without having had access to a lawyer or the chance to make their arguments, said Patricia Fernandez Vicens, the lawyer for one of the rights groups, Coordinadora de Barrios.
"It is an activity that is legal and possible as long as it is carried out with a series of guarantees," she told AFP.
The court in Ceuta agreed to hear the case and said "the only decision possible" was to order the suspension of the deportation of the 12 minors while it considers arguments.
While that may complicate moves by Spain to deport the other minors, three of the migrants the activists were defending have already been sent back to Morocco.
They were among up to 10,000 migrants who crossed the land border into Ceuta over several days in May as Moroccan border guards stood aside.
Earlier Monday, Spanish Interior Minister Fernando Grande-Marlaska defended sending unaccompanied children back to Morocco, saying "vulnerable" migrants were not among those being repatriated.
"The best interest of the child is guaranteed," he told news radio station Cadena Ser.
Most of the migrants were returned to Morocco soon after they arrived in May, but at the end of July some 2,500 remained in Ceuta, according to the authorities there.