ABU JAMAL, Sudan — At Sudan’s eastern border, Lt. Samih Omar led two patrol cars slowly over the rutted desert, past a cow’s carcass, before halting on the unmarked 2,000-mile route that thousands of East Africans follow each year in trying to reach the Mediterranean, and then onward to Europe.

His patrols along this border with Eritrea are helping Sudan crack down on one of the busiest passages on the European migration trail. Yet Lieutenant Omar is no simple border agent. He works for Sudan’s feared secret police, whose leaders are accused of war crimes — and, more recently, whose officers have been accused of torturing migrants.

Indirectly, he is also working for the interests of the European Union.

“Sometimes,” Lieutenant Omar said, “I feel this is Europe’s southern border.”

Three years ago, when a historic tide of migrants poured into Europe, many leaders there reacted with open arms and high-minded idealism. But with the migration crisis having fueled angry populism and political upheaval across the Continent, the European Union is quietly getting its hands dirty, stanching the human flow, in part, by outsourcing border management to countries with dubious human rights records.