GENEVA (Reuters) - U.S. President Donald Trump’s nominee for the top U.N. migration job was roundly rejected on Friday after a candidacy that was dogged by a history of social media posts disparaging Muslims and overshadowed by Trump’s policies on migrants.

Ken Isaacs, U.S. candidate for Director general of the United Nations' International Organization for Migration (IOM) is pictured in this photo released by U.S. Mission Geneva, in Geneva, Switzerland, June 28 2018. U.S. Mission Geneva/Handout via REUTERS

Ken Isaacs, vice president of U.S. evangelical charity Samaritan’s Purse, came last in the race to lead the International Organization for Migration (IOM), behind Costa Rica’s Laura Thompson and Portugal’s Antonio Vitorino, the eventual winner of the contest.

“The role of the International Organization for Migration is fundamental, it’s fundamental to build bridges among countries, and countries which have different levels of economic development,” Vitorino, a former European Commissioner, told reporters after his election.

Isaacs said he had congratulated Vitorino and it had been an honor to run as the U.S. candidate. He declined to comment on why he lost the secret ballot of IOM member states.

A U.S. State Department official said all three candidates were highly qualified.

“IOM is an important partner for the United States around the globe, and we are committed to working with IOM to address root causes of migration and to promote safe and legal migration,” the official said.

The leadership race came at a crucial time for global migration politics, as Trump attracts criticism for his “zero tolerance” policy on the Mexican border and the European Union struggles to find unity on how to deal with the influx of mainly African migrants across the Mediterranean.

Isaacs’ candidacy began shortly after Trump questioned why the United States would want immigrants from “shithole countries” and ended just a federal court overturned his policy of separating immigrant parents and children caught crossing the Mexican border.

The IOM job has traditionally gone to an American and the White House had strongly backed Isaacs, despite U.S. withdrawals from other international bodies and agreements, including the U.N. Human Rights Council and U.N. talks on a wide-ranging “global compact” on migration.

Jeremy Konyndyk, senior policy fellow at the Center for Global Development, and like Isaacs a former director of U.S. Foreign Disaster Assistance, said the rejection of the American candidate was “a big deal”.

“IOM has been led by an American for 50 years. This reflects a huge erosion in U.S. global standing under Trump,” he wrote on Twitter. He said the voting countries might anticipate U.S. retaliation against IOM, such as funding cuts, if Isaacs lost.

“Yet even with that, he didn’t merely lose -- he flopped badly.”

Keith Harper, who served as U.S. human rights ambassador under President Barack Obama, said in a tweet that Isaacs’ rejection was “yet another sign that U.S. power, authority and prestige has been so dramatically diminished”.

During the 1990s, Vitorino was a minister in the Portuguese government of Antonio Guterres, now U.N. Secretary General. He said they had been close friends for 40 years, even when they did not agree.