TRIPOLI, Libya — Thousands of African migrants who have endured deprivation and even torture in a bid to reach Europe are now facing even greater peril, trapped in the middle of the renewed warfare that has gripped this capital city for three months.

More than 10,000 migrants who have set out across the Mediterranean over the past year have been returned to Libyan detention centers after stringent European anti-migration policies took effect, aid officials say, while many others have been blocked from even setting sail.

On Tuesday night, an airstrike shattered a detention camp in a Tripoli enclave, killing at least 53 migrants. The strike, which also left more than 130 wounded at the Tajoura detention facility, inflicted the most civilian casualties in a single day since combat erupted between a renegade Libyan commander, Khalifa Hifter, and militias aligned with the U.N.-backed government in Tripoli.

It was the latest horror, perhaps among the worst, visited upon tens of thousands of mostly sub-Saharan African migrants and refugees who have streamed into Libya in recent years. Many have escaped conflicts, political repression, ethnic pogroms and poverty in their homelands only to be caught up in someone else’s war.

Thousands remain in detention centers run by Libyan militias or in homes near front-line fighting, exposed to airstrikes and mortar and rocket fire. Indiscriminate gunfire has wounded some of them, while the militias have tried to forcibly recruit young migrants, according to migrants and humanitarian officials. Food is running short inside detention centers, and some migrants locked inside have died by suicide, aid workers said.

On Friday, there were at least 359 detainees still in the pulverized Tajoura detention center, which housed 600 migrants and refugees before the attack, Doctors Without Borders spokeswoman Karin Ekholm said in an email.

The Tajoura facility had been targeted previously, the group said. An attack on the compound in May struck about 80 yards from a cell holding women and children, sending a large piece of shrapnel crashing through the roof. After that assault, new migrants continued to be housed in the facility, aid workers said.

“What horrible thing has to happen next before these people who remain locked in cells, without any ability to flee from the fighting, are evacuated out of the country to safety?” asked Craig Kenzie, the Tripoli project coordinator for Doctors Without Borders.

Since the conflict began in early April, more than 1,000 migrants and refugees have been returned to Libya after trying to reach Italy and other European countries, according to the group.

U.N. officials say more than 6,000 migrants and refugees remain in the country’s 34 detention centers, including 3,300 held in facilities in and around Tripoli. Some centers are run by militias involved in human smuggling, and migrants in interviews have described torture and slavery-like conditions. Other migrants are in schools that have become displacement centers, dependent on charities for survival. None of the detention centers have been evacuated after the Tajoura tragedy, Ekholm said.

For months before the airstrike Tuesday, U.N. and other aid groups had been calling for more refugees to be evacuated to other countries. These groups also demanded that Libya’s coast guard, partly trained and funded by the European Union, halt the return of migrants and refugees stopped at sea. Italy and other European countries have refused entry to humanitarian ships carrying rescued migrants.

“People should not be disembarked in Libya,” said Jean Paul Cavalieri, the head of the United Nations’ refugee agency in Libya.

Now, the calls to change Europe’s anti-migration policies have grown louder, with senior U.N. officials describing Tuesday’s attack as a possible war crime and demanding an investigation.

E.U. spokeswoman Maja Kocijancic said the union’s assistance to the Libyan coast guard is designed to prevent migrants from drowning at sea. “We are not turning a blind eye to the situation of migrants in Libya,” Kocijancic said.

But while the E.U. condemned Tuesday’s attack in a pair of statements and called for a probe, it did not address the growing chorus of demands that European countries change their migration policies.

Human trafficking

Fleeing repression in his native Eritrea, Munir Abdallah and his family had turned to smugglers for help escaping. With his wife and two children, now 2 and 7, they first went to Sudan, then crossed into Libya last year, he said. By then, the lawlessness after the ouster of Libyan dictator Moammar Gaddafi in 2011 — following the Arab Spring uprising and NATO intervention — had turned the country into a human-trafficking gateway to Europe.

When they reached the southwestern Libyan town of Zella, his family was sold to another trafficker, who Abdallah said tortured him and raped his wife. Every morning, he said, he was handed a cellphone to call relatives and beg for money. Their abusers beat him or gave him electric shocks so his relatives could hear his screams, he said, and sometimes his jailers would wrap him up in chains, point a gun to his head and snap a picture. Then, they would send it to his relatives, he said. 

Women were often taken to rooms without their husbands. “Every time a woman goes in there, she would not leave without something happening to her,” said Abdallah, 27, as his wife stared blankly at the floor.

By the time Abdallah and his family arrived in Tripoli in December, they had run out of money and ended up at an overcrowded detention center in the Qasr Ben Ghashir enclave.

Then, in late April, Libya’s civil war reached them.

Every morning, they woke up to the sound of mortars and gunfire. “At night, we went to sleep fearing airstrikes,” Abdallah recalled.

“It was getting too dangerous,” he said. “But where could we go? There was gunfire and shelling outside. We could hear jets flying above. One shell landed close to the ladies’ compound.”

Within days, stocks of food were depleted. “Some people were drinking water mixed with sugar,” Abdallah said.

On April 23, fighters in camouflage attire arrived in tanks and pickup trucks mounted with large machine guns. The men stormed into the center, firing guns in the air, confiscating cellphones and beating migrants. “Then they shot one guy and everyone started to scream,” Abdallah said.

Abdallah’s account is corroborated by U.N. officials, human rights groups and videos posted by survivors on social media of distressed refugees and migrants, some with visible gunshot wounds. By the time the fighters left an hour later, a dozen migrants had been wounded by bullets and were hospitalized, according to the U.N. refugee agency.

The Tripoli government accused Hifter’s forces of staging the attack. Abdallah said he could not determine which side was responsible.

Two days later, the United Nations sent buses to evacuate the center. Abdallah and his family went to a displacement facility inside a school in downtown Tripoli. There, Libyan charities provided food, medicine and other care. It was the first time Abdallah felt secure in Libya.

“We feel like we are dealing with human beings,” he said.

Fleeing war, under fire again

Rawiya Youssef had fled war in Sudan’s Darfur region, arriving in Libya last year. A few months later, she hopped into an overcrowded smuggler’s boat bound for Europe. But it was stopped by the Libyan coast guard. 

She and scores of other migrants were brought back to a detention center in Tripoli’s Ain Zara enclave. “The guards beat us with sticks and rubber hoses and called us racist names,” recalled Youssef, wearing a red headscarf that framed her solemn face as she told the story. “We were given only one meal a day.”

Earlier this year, Youssef managed to escape by bribing a guard, she said. She went to stay with Asya Ibrahim Adam, 48, a mother of three who fled Sudan in the mid-1990s and found a life cleaning homes in Tripoli. In early May, a group of fighters arrived at Adam’s door, demanding to know whether her two sons, ages 23 and 21, were inside. 

She told her sons to hide. “They were trying to get Asya’s kids to join their militia,” Youssef said.

The fighters left but returned the next night and knocked on more doors. “Other Sudanese families with fighting-age kids were also targeted,” Adam said. 

As the fighting entered the enclave of Al Swani, Daoud Adam and his family fled their home to a nearby school. But within days, shells began to rain down, and they fled back to their home, he said.  A shell nearly hit their residence, and gunfire is a constant worry. “We’re still on a front line,” said Adam, 37, also from Sudan but unrelated to Asya. “But at least we know this area. We know where to hide.”

He remains anxious. There have been widespread rumors that non-Libyans had joined the fighting. “We are afraid that some people may see us as mercenaries,” Daoud Adam said. “Both sides accuse us in this way.”

As the war continues, and summer brings calmer waters on the Mediterranean, aid agencies and Libyan coast guard officials expect more migrants to try to escape the fighting.

The migrants’ deteriorating plight has sparked concerns that more will risk their lives to cross the Mediterranean, often in rickety, unsafe vessels. The death rate so far this year among migrants trying to reach Italy or Malta, the closest European nations to Libya, by sea is nearly twice that of the same period in 2018, with 1 in 10 migrants perishing, according to the International Organization for Migration.

But Youssef and Abdallah are already plotting their escapes.

“If I find money, I will try again to reach Europe,” Youssef said.

“What other choice do we have?” Abdallah said. “I was hoping to find a better life than what I left at home. But I found worse than that.”