European leaders are changing their course as their efforts to curb migration have triggered what the U.N. and other groups condemn as massive humanitarian failures. Deeply divided over how and where to control Europe’s borders, leaders met Wednesday in a summit in Austria.

One of Europe’s main solutions to migration — Greece’s overcrowded, unsanitary Moria migrant camp — has suicidal children and conditions that a psychiatrist compared to “an old-fashioned mental asylum.”

In another heavily criticized solution to immigration, imprisoned men and women have been shuttled away from one gun battle only to end up incarcerated on the front line of another, vulnerable to both trafficking and new abuse.

The jammed Moria camp on the Greek island of Lesbos and the dangerous migrant detention centers in Libya serve as a sober reminder that the current plans seem to be unworkable.

Migrant sea arrivals to Europe have plummeted this year, but each journey now carries increasing risks of death or indefinite detention in squalid conditions. More than 1,700 people already have died on Mediterranean crossings this year.

Abbas Elnaser, an Iraqi who arrived in Moria about three weeks ago, said his 8-year-old daughter’s health always had been frail, and she was deteriorating quickly in the camp that was built for 3,100, but now houses over 9,000 people.

“She has problems breathing most of the time, she has problems in her lungs,” he said. “The tent is surrounded by garbage.”

In the central Mediterranean, Europe effectively has outsourced sea rescues of migrants to the Libyan coast guard; its boats have returned 13,000 migrants to Libyan detention centers this year. In some of those centers around the Libyan capital of Tripoli, migrants ended up on the front lines of gun battles as militias fought for control of the city.

At one point in the fighting, detainees abandoned by their jailers for days broke out of at least one center but ended up caught in a gun battle. A half-dozen people were shot, according to Ibrahim Younis, head of the Libya mission for the aid group Doctors without Borders.

As a Tripoli cease-fire brokered by the U.N. threatens to fracture, food for the detainees there is dwindling. Libyan officials have complained that both they and the migrants have been largely abandoned by Europe. In the Janzour detention center, around 900 people were crammed into a space intended for half that many.

“We have difficulties in providing subsistence, difficulties in providing food, and difficulties in sheltering them,” said 1st Lt. Jamal Hussain. The government, which runs the facility, refused to allow an Associated Press journalist to speak to detainees.

The official number of asylum-seekers and refugees in detention in Libya is around 5,000, but thousands more are believed to be captive in warehouses and other buildings, where there have been widespread reports of slavery, sexual abuse and other atrocities.

This month the U.N. broke its silence over Europe’s policy of allowing the Libyan coast guard to intercept migrants, saying it was untenable and putting thousands of people at risk of being jailed indefinitely in inhumane conditions. Detailing allegations of torture, sexual abuse, violence and “nightmarish” conditions, the U.N. refugee agency said Libya didn’t remotely meet the criteria “as a place of safety.”

In all, around 56,000 refugees and asylum-seekers are registered with the U.N. in Libya and neighboring Niger, which have accepted millions of euros in exchange for European promises to evaluate a portion for resettlement.

But, critics say, resettlement simply isn’t happening. A total of 657 people had left for resettlement in Europe as of last week, out of 3,886 slots promised over a year ago in 11 European countries and Canada.

Meanwhile, the Libyan and Greek detention centers have continued to fill, with migrants and refugees waiting a year or more for a decision in their cases. That, however, suits many anti-immigrant populists in Europe just fine.

“Until the message is made abundantly clear that illegal economic migrants will not be processed, that boats will be turned back, thousands and thousands more sad and desperate lives will be lost in vain, all for your feelings of virtue,” said Nathan Gill, a British member of the European parliament, accusing fellow legislators last week of being soft on immigration. “You’re not really helping people.”

If migrants have made it to the Greek island of Lesbos, they’re already one step ahead of those trapped in Libya. But conditions are hardly better. Raw sewage flows out the main entrance in Moria, garbage piles up outside the containers where migrants sleep.

Luca Fontana, who works for Doctors without Borders in Lesbos, said a quarter of the minors there had either attempted suicide, had suicidal thoughts or were harming themselves.

“Only last week had to suture the wrists of a couple of unaccompanied minors, they tried to cut their veins inside Moria camp,” he said.

Psychiatrist Alessandro Barbero of Doctors without Borders said Moria was as grim as “an old-fashioned mental asylum, not seen in parts of Europe since the mid-twentieth century.”

Any hope of an easy solution to Europe’s immigration dilemma has faded.

Paolo Campana, who has studied the smuggling networks that lead through Libya, has said a solution is possible only if legal migration into Europe opens up at the same time as peace, stability and prosperity emerge in violence-plagued nations like Iraq, Syria, Ethiopia and Eritrea.

“We need to be humanitarian and to be pragmatic,” he said.

As of last week, 73,696 migrants and refugees have entered Europe by sea this year along with over 11,000 land arrivals, compared with 128,993 sea arrivals in 2017 and 298,663 in 2016.

European leaders in June proposed creating centers to process migrants in North Africa but those governments quickly rejected the idea. The EU now is pitching plans of an upgraded border force.

Last week, Austria and Italy’s right-wing interior ministers called for shipboard screenings of migrants on the Mediterranean, raising new questions about whose ships and where — given that Italy has blocked humanitarian groups from docking with migrants rescued at sea, favoring Libyan boats instead.

Riccardo Magi, an Italian lawmaker from the tiny left-wing +Europa party, said Libya’s deteriorating crisis has risked sending migrants and refugees on ever smaller boats into greater danger.

“What is sure is that the departures will continue and that deaths will continue to occur and that there will be fewer and fewer eyes” on the sea to rescue those in need, Magi said.

Two survivors of a deadly wreck who were picked up by the coast guard later were imprisoned and tortured, said Giorgia Linardi, a spokeswoman for the SeaWatch rescue boat. The two escaped in July and again set sail, this time being rescued by the NGO ship Aquarius.

Linardi said at least one of the two has brought a case to the European Court of Human Rights for alleged violation of the EU convention banning torture.

Trying to tackle the enormous problem at Moria, Greece on Tuesday agreed to transfer 2,000 asylum-seekers from the camp on Lesbos to the mainland this month. The move could not come soon enough for the migrants there. Ali Sajjad Faizy, a 19-year-old from Afghanistan, said conditions at Moria steadily have worsened and residents must stand in line “for four or five” hours just to get food.

“It’s completely full,” he said.

The Associated Press contributed to this report.