Coast guard members watch a video of one of their missions in Zawiyah, Libya. The European Union has poured money into supporting Libya’s coast guard in rescue operations off the coast. But the violent tactics of some units have raised questions about the alliance. (Lorenzo Tugnoli for The Washington Post)

The video showed a small rubber dinghy crowded with terrified migrants. Next to it, a uniformed man in a Libyan coast guard boat was yelling and wielding a bullwhip.

The whip slithered through the air and struck a shirtless migrant. The Libyan cracked the whip again, forcing some of the panicked migrants to fall into the sea and struggle to clutch the side of the boat.

“We have to punish them to make them calm down,” said Ramzi Ali, a member of the coast guard unit, shrugging after playing the video on his cellphone. “We need to keep control. They can take our life.”

The European Union has poured tens of millions of dollars into supporting Libya’s coast guard in search-and-rescue operations off the coast. But the violent tactics of some units and allegations of human trafficking have generated concerns about the alliance.

The sea incident and other accounts of abuses come amid a deepening battle between human rights groups and authorities over the flow of tens of thousands seeking refuge to Europe.

(Jason Aldag,Sarah Parnass/The Washington Post)

The tensions are particularly prevalent in the seaside city of Zawiyah, where the coast guard is aligned with a powerful militia and armed groups are fighting to control revenue from smuggling people and oil. The factions are among the European Union’s dubious partners in efforts to stop mostly African migrants from reaching its shores.

To most migrants, being “rescued” by the coast guard means a forced return to Libya, where they are exposed to more abuse, incarcerated and even sold again to smugglers.

“They beat everyone and took everything,” said Jafar Khalifa Ibrahim, 36, an Ethiopian migrant, recalling the April day that he and scores of others in a rickety boat were intercepted by a coast guard unit, robbed of their few possessions and deposited in an abysmal detention center.

[‘They are not treated like humans’]

In the spacious office of the Zawiyah coast guard, a rail-thin commander seated on a couch devoured his lunch. Abd al-Rahman Milad was tired and hungry after a long night of patrolling.

His deputy, Ali, had just proudly shown the video to a Washington Post journalist. When he heard Ali’s explanation for whipping migrants, Milad nodded in approval.

Six years ago, at the start of the Arab Spring uprising, Milad left Libya’s Naval Academy and joined rebels who were revolting against Moammar Gaddafi’s regime. “I was shot nine times during the revolution,” said Milad, 31, raising a scarred hand.

After Gaddafi’s fall and death, militias vied for control of territory, influence and the North African nation’s petroleum resources. Milad’s powerful tribe — the Awlad Bu Hmeira — seized Zawiyah’s refinery. With the help of his tribe, Milad took control of the port and made himself head of the local branch of the coast guard, U.N. investigators said in a report last month.

He soon became known by his nom de guerre: al-Bija.

With three competing governments, including one backed by the West, rule of law is largely absent in Libya today. Power is mostly in the hands of militias, which run town councils and operate the coast guard in coastal cities.

NATO airstrikes in 2011 to help oust Gaddafi destroyed much of the Libyan Navy’s fleet — and its ability to patrol its 1,100-mile coastline. With the economy shattered, coast guard employees have not been paid in months. Meanwhile, Libya has become the largest crossing point for migrants to Europe. More than 70,000 have reached Italy this year, and more than 2,100 have drowned trying.

[A day in Libya’s capital, just as the civil war reignites]

Warlords such as Milad have filled the void, dispatching their crews to patrol Libya’s waters with boats labeled “Libyan Coast Guard.”

Milad said his men lack resources and get little credit for their operations. “Why doesn’t Europe do more to support smaller coast guards like us?” he said. “We stop oil traffickers. We’ve rescued thousands of migrants and taken them back to Libya.”

But U.N. investigators and human rights activists say Milad and his crew patrol the seas to protect their own criminal activities.

A militia called the al-Nasr Brigade, commanded by one of Milad’s tribesmen, became active in migrant smuggling and started a detention center, said U.N. investigators. Milad and his coast guard unit, they added, are closely linked to the militia in oil and migrant smuggling. Milad’s crew hands migrants over to the detention center, a squalid facility where they are starved and often beaten. The center, U.N. investigators said, is used to sell migrants to other smugglers. And female migrants “were sold on the local market as ‘sex slaves.’ ”

The U.N. investigators said that Milad and other coast guard members “are directly involved in the sinking of migrant boats using firearms.” Some Libyan and Western security officials said the coast guard charges smugglers a fee for each boat, and those who do not pay are targeted.

Milad denied that his units traffic in migrants. The smugglers, he said, wear uniforms similar to those worn by his men, “so the international aid agencies think the coast guard is trafficking in humans.”

“They can’t prove we are involved,” he said.

A spokesman for Libya’s Navy, under control of the Western-backed government, called the accusations against the coast guard “fabrications.”

“Instead of having these organizations support us to save more people, they attack us as if they are aiding the smugglers not the Navy,” said the spokesman, Brig. Gen. Ayoub Qassem. He said Milad’s coast guard unit is one of the most active in “rescue missions and in stopping illegal migrations,” and so he “has many enemies.”

At a meeting in Brussels last month, E.U. leaders described the Libyan coast guard as a key ally and pledged more financial assistance to Libya’s Navy.

Catherine Ray, an E.U. spokeswoman, said that the organization takes seriously the allegations against the coast guard, and that better training was a way to improve conditions. To date, she said, 133 members of the Libyan coast guard have been trained in courses that “puts a strong focus on human rights and women’s rights.”

Humanitarian organizations are unconvinced.

They say gun-wielding coast guard units have tried to stop them from rescuing migrants at sea. Several migrants in detention centers in Zawiyah and Tripoli told The Washington Post that the coast guard seized their cellphones, money and jewelry.

European authorities “should not be providing support to the Libyan coast guard, either directly or indirectly,” said Annemarie Loof, an operational manager with Doctors Without Borders, an international humanitarian group. “This support is further endangering lives.”

Milad denied that his men robbed migrants but said that sometimes migrants give them phones and other possessions for safekeeping.

In Zawiyah, the mere mention of Milad’s name allows passage through militia checkpoints. He and other coast guardsmen own Mercedes and expensive SUVs. When asked how they earn money, Milad said they had other jobs but declined to provide more details.

But his power is also under threat.

In recent months, clashes have erupted between tribes for control of the city’s migrant smuggling trade.

In April, Milad and his crew spotted a boat filled with migrants. As they approached, smugglers in another boat opened fire on them, he said. Less than an hour later, four of the smugglers were dead, and three others injured.

The smugglers belonged to another influential tribe, and in Libya, tribal allegiance trumps all other relationships.

“We tried to avoid shooting them because of the tribal situation,” said Milad. “But we had to fight back.”

As per custom and tradition, elders from both tribes negotiated a blood-money settlement to prevent revenge attacks. Milad was ordered to pay $185,000 to the smugglers’ families.

But Milad is considering not handing over the sum, which would allow his rivals to buy more weapons and influence.

“If we pay, do you think they will not chase us again?” he said.

Read more:

A European deal with Libya could leave migrants facing beatings, rape and slavery

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news