Spain on Tuesday defended holding in prison nearly 500 migrants who arrived in the country by boat.
Following criticism by rights groups, the Spanish government said it was due to a lack of space at immigration detention centres.
"We feel it is better that the migrants be held in a centre with the latest technology, with sanitary facilities, showers, heating, beds, sports areas than to put them in camps like in other countries," Interior Minister Juan Ignacio Zoido told radio Onda Cero.
Just under a thousand migrants, mainly Algerians, arrived on several boats in the south of Spain since Thursday, according to the interior ministry.
Half were intercepted near the coast of the southeastern region of Murcia and the "majority" of these were taken to a new jail that has yet to open in the southern town of Archidona near Malaga, local migrant rights group Malaga Acoge said.
"We are radically against this," the head of the group, Alejandro Cortina, told AFP.
"We don't know it they will have staff authorised to detect human trafficking, or if a judge will monitor this facility" as is the case with immigration detention centres, he added.
Migrants who arrive in Spain by boat are usually initially detained in police facilities for identification and processing before being sent to an immigration detention centre while their asylum claim is processed.
The Jesuit Migration Service, which aids migrants at these centres, also criticised the decision to house migrants at the jail which is set to open its doors to prisoners next year, saying it violated "rights and constitutional guarantees" and "unfairly criminalises people".
According to the International Organization for Migration (IOM), 17,687 migrants reached Spanish shores by boat between January 1 and November 15, compared to 5,445 during the same period in 2016.
While Italy received 114,000 migrants during this period, and Greece around 25,000, Spain is becoming an increasingly popular entry point into europe for migrants seeking to avoid passing through war-ravaged Libya.