Some said they had spent two months or more here or in similar centers, although they are sometimes hired as day laborers and returned at night.

“We are like slaves,” said Abu Bakr Dixon, 34, a Gambian held at the Zawiyah detention center. He had survived the capsizing of his migrant boat by clinging to an empty barrel with a friend until they were rescued; at least 61 others with him drowned.

Col. Milud Jummah, the official in charge of the Abu Salim center, directed men from one of the rooms to kneel in tight rows in the courtyard — a chance to get some sunlight, he said. Rows of barbed wire blocked off most of the outdoor space, and armed guards prohibited the migrants from moving around.

“Do not expect them to be normal humans,” Colonel Jummah said, explaining the heavy restrictions.

The migrants are ostensibly awaiting repatriation to their home countries, and the International Organization for Migration recently helped Senegal bring back about 400. But detention officials said Senegal was an exception. Many African countries have shut down their embassies in Libya or simply neglect their migrants. Eritrea considers them defectors and thus criminals.

A more common exit involves the payment of a $500 or $1,000 bribe to the jailers by a migrant or his family and friends, according to migrants and several Libyan officials. Often, smugglers help transmit bribes from a migrant’s distant family members and then sell a second seat to the same passenger. One consequence is that the detention system only increases the determination of many migrants to escape Libya as soon as possible. One smuggler said he often saw repeat customers.

At the Zawiyah detention center, Hermon and Efrem appeared to feel the same way. Both boys said they had sneaked away without telling their parents. They said siblings who had already made the trip by boat to Italy from Libya had managed to send money for smugglers to bring their younger brothers to join them.

None of the roughly three dozen Eritrean boys had any idea how they might get out of the detention center or what their future might hold. But when asked if they wanted to return home to their parents, the answer was unanimous.

“We want to go to Italy,” they said.