GENEVA (Reuters) - African migrants rejected by Italy in a standoff with the European Union last week said they had been held by smugglers for up to two years in Libya and many had been beaten, tortured and raped, the U.N. migration agency said on Tuesday.

The 150 migrants, mainly Eritreans and Somalis, were rescued in the Mediterranean on Aug. 15 but waited 10 days while Italy’s anti-immigrant government refused to let them disembark, until Ireland, Albania and the Vatican agreed to accept them.

A further 27 unaccompanied minors and 13 people needing urgent hospital treatment had earlier been allowed ashore in Italy, whose government had threatened to cut funds to the European Union unless other states took in the migrants.

The U.N. International Organization for Migration (IOM) said its staff had gathered testimony from the migrants.

All were malnourished and exhausted and said they had been held against their will in Libya for up to two years, IOM spokesman Joel Millman told a U.N. briefing in Geneva.

“In Libya they complained that many had been beaten and tortured by smugglers and traffickers seeking ransom money from their families in their countries of origin,” he said.

“Italian doctors who attended all the women ... reported that many of them said they had been raped while in Libya.”

He said IOM believed thousands of migrants were still being detained - held in safehouses or warehoused, but getting people to the shore had recently become more difficult because of violence in the west of the country.

A drop in the value of the Libyan dinar had also made it more difficult for sub-Saharan Africans hoping to earn enough in Libya to fund their sea voyage to Europe, prompting the smugglers to look for other nationalities with more resources.

Italian Interior Minister Salvini, who has led a popular crackdown against immigration since his government took office in June, has said he was under investigation by a Sicilian prosecutor for abuse of office, kidnapping and illegal arrest over the migrant standoff.