In mid-January, Kevin Moley, the senior State Department official responsible for overseeing U.S. relations with the United Nations and other international organizations, issued a stern command to a gathering of visiting U.S. diplomats in Washington: China was on the rise, and America’s diplomatic corps needed to do everything in its power to thwart Beijing’s ambitions.

China’s bid to place one of its own top officials at the head of the Rome-based U.N. Food and Agriculture Organization (FAO), which helps direct agricultural and food security policies worldwide, offered an early test, Moley noted. The election was still some five months away. But Moley, the U.S. assistant secretary of state for international organization affairs, made clear that defeating China would become a key U.S. foreign-policy goal.

“It was all China, China, China,” recalled a source familiar with the exchange. “‘We have to do anything to beat the Chinese,’” the source recalled Moley as saying.

Five months later, the race ended in a stinging defeat for the United States. Beijing’s candidate, Qu Dongyu, the vice minister of agriculture and rural affairs, overwhelmingly won the June 23 election with 108 out of 191 votes from the organization’s 194 member countries. U.S. diplomats initially anticipated their favored candidate, a former Georgian agriculture minister, receiving at least 60 votes. He ended up getting 12.

The win marked an international triumph for China, showcasing its growing political and economic might and its newfound ability to seed top jobs at international institutions with hand-picked candidates. But the race also fueled allegations that it forgave tens of millions of dollars of debt to an African state in exchange for withdrawing its candidate from the race and threatened economic retaliation against smaller and more developing countries if they opposed China’s plan.

The story, drawing on interviews from nearly two dozen officials and experts, also exposed the confused and clumsy state of diplomacy in the Trump administration. Critics charge that the president and his top diplomats are ceding influence in international organizations while at the same time trying to keep China from assuming greater control of them.

Throughout the process of the FAO election, Washington ignored repeated warning signs about its own strategy, clashed with some of its closest allies, and ultimately paved the way for China to coast into a diplomatic win that could elevate its signature foreign-policy ambitions in the developing world.

The FAO election placed a former senior Chinese government official at the head of an agency that will decide, along with the U.N. secretary-general, who will be the next leader of the World Food Program, a U.S.-led U.N. agency that tackles global famine and food insecurity issues. Qu will have the authority to sign off on all high-level staff appointments at the agency, complicating future U.S. efforts to maintain its dominant role there.

“[Qu] is certainly qualified on paper. He has the right experience to be in this position,” said Kimberly Flowers, an expert on food security issues at the Center for Strategic and International Studies. “If it was anyone else from any other country, I don’t think it would be a big deal.”

The FAO, with more than 11,500 staff, flies below the radar of other, higher-profile international bodies. But experts and officials say it is incredibly important for global food security and agricultural industries, in both the United States and developing countries, where Beijing sees agricultural development as a bridgehead for political clout. The FAO sets international standards for food and animal safety and plays a key role in crafting international responses to global hunger, climate change caused by world food production, and priorities in global farming industries.

The internal battle over the FAO chief came as Washington’s national security establishment—and members of Congress from both parties—had become increasingly alarmed with China’s growing influence at the United Nations.

Over the past three years under President Donald Trump, the United States has pared back its funding and clout at the United Nations, withdrawing from key U.N. bodies and racking up unpaid bills to the institution. China has stepped in to fill the void, securing broad U.N. support for the crown jewel of President Xi Jinping’s foreign policy, the Belt and Road Initiative, and snatching top jobs in the U.N. system for Chinese nationals. Of the 15 specialized agencies under the U.N., Chinese nationals now head four of them. France, the United Kingdom, and the United States each lead one—though the three Western powers continue to hold monopolies on the most influential U.N. jobs overseeing peacekeeping, humanitarian relief, and political affairs.

China’s Growing U.N. Clout Chinese nationals now head four of the 15 specialized agencies

under the United Nations.

China has also succeeded in tamping down international criticism of its mass detention of more than a million ethnic minorities, mostly Uighurs, in the country’s western region of Xinjiang. It secured a minor public relations coup by having the U.N. counterterrorism chief visit the region in June, shoring up its dubious claims that its activities in Xinjiang are reeducation programs aimed at rooting out terrorism.

China’s race to lead the FAO provides a stark example of how it has been gradually chipping away at the United States’ dominant position at the U.N. and other international organizations, prompting fears among U.S. diplomats and lawmakers that it will use its new power to advance Chinese interests over international ones.

“Chinese leadership is not inherently bad—to an extent, the United States should be pleased that Beijing is seeking to take on more responsibility in international organizations. The problem lies in the fact that it’s abusing this responsibility,” said Kristine Lee of the Center for a New American Security. “Chinese officials report back to Beijing and first and foremost serve the narrow interests of the [Chinese Communist Party], rather than truly advancing multilateralism and strengthening transparency and accountability at the U.N.”

Some U.S. officials are still quietly reeling from the defeat. “Everybody was just asking why, how … this happened,” one U.S. official said. “It made us look like complete fools.”

Top State Department officials have vowed not to make the same mistake again. For instance, the department’s regional bureaus, which were largely inactive during the campaign, will now be instructed to play a more proactive role corralling votes from capitals in their regions, according to one source involved in the deliberations.

Moley, a senior Trump appointee who led the campaign, recently announced that he planned to retire from the department at the end of November. His departure follows the publication of a State Department inspector general report accusing him and another political appointee in his office of mismanagement and retaliation against career officials deemed insufficiently loyal to Trump. (Moley is one of several political appointees at the State Department who have been accused of mismanagement or mistreating staff. He has denied the charges leveled against him in the inspector general report.)

David Hale, the U.S. undersecretary of state for political affairs, recently addressed the FAO election at a closed-door town hall at the State Department, according to an account of the meeting obtained by Foreign Policy. “We’ve got some lessons to learn from that experience that we’re now applying to some of the other battles coming up,” he said.

Moley’s call to action back in January reflected Washington’s alarm over China’s growing success at the United Nations. But the strategy for beating the Chinese in Rome puzzled many of the department’s rank-and-file officials. Moley proposed that the United States throw its support behind a former Georgian agriculture minister, Davit Kirvalidze, who had resigned from his job in May 2013 after several subordinates had been charged with corruption crimes. Kirvalidze was not charged with a crime.

Some U.S. officials felt Kirvalidze demonstrated insufficient understanding of how the FAO functioned, while his government had never participated actively in the work of the U.N. food agency. They thought Kirvalidze lacked a high enough profile in Rome to stand a chance of winning and that the emergence of a consensus European candidate, the French agronomist Catherine Geslain-Lanéelle, heightened the chances of a Western split in votes, enhancing China’s prospects for victory. The strategy, recalled one U.S. official, was “bonkers.”

Others felt Kirvalidze, with nearly three decades of experience in agriculture and rural development, was a credible candidate and could bring valuable experience from a small post-Soviet country that transitioned to a free market democracy. They said Kirvalidze took his candidacy seriously, putting out detailed policy proposals and visions for the FAO if he were elected, and remained engaged in discussions with FAO member states throughout the process.

Qu, meanwhile, was viewed as the candidate to beat. The son of a rice farmer, and an agricultural scientist by background, he had worked his way up the career ladder in Chinese academic and government circles to become vice minister of agriculture and rural affairs, overseeing agricultural initiatives under the Belt and Road Initiative and Beijing’s agricultural modernization plans in Africa. But his victory was by no means seen as inevitable. More than a year earlier, a Chinese-backed candidate had emerged as the front-runner for the top job at UNESCO, but he lost the race decisively to a French candidate, reflecting international trepidation over China’s leadership in a major international cultural organization.

The months that followed, officials said, showcased clumsy diplomacy within the U.S. government, as well as infighting among Western allies over which candidate to back. The European Union rallied behind Geslain-Lanéelle, who won 71 votes but was unable to draw support from the United States, which expressed reservations about France’s approach to food security and stances on issues such as genetically modified organisms, or GMOs, in agriculture.

From the start, there was a deep divide within the Trump administration, with many working-level staffers in the State Department and the National Security Council favoring the French candidate. “There was not a unity of effort in the U.S. government, which significantly damaged [Kirvalidze’s] chances,” one source said. The tug of war over which candidate to back in this election reflected broader tensions between the United States and Europe under the Trump administration.

The strategy, recalled one U.S. official, was “bonkers.” That left it to Georgia, a country of just 4 million people, to wage a campaign against two major powerhouses, China and France, whose candidate enjoyed the full backing of the European Union. The campaign was overseen by Georgia’s U.N. ambassador in New York. But European diplomats said other Georgian officials were largely absent in Rome, leaving a team of American advisors outside the U.S. government to manage a campaign that promoted a greater role for the private sector in the FAO’s work.

According to one source directly involved in the race, Georgia faced “dirty politics from Paris and Brussels” in an attempt to get it to relinquish its candidacy and back the French candidate.

Rumors quickly spread through European circles that Kirvalidze was drunk at a Chatham House program in Rome in April.

But Kirvalidze’s defenders, including his American backers, said they were spreading false rumors; in reality, they claimed, he had food poisoning.

A video recording of the event showed Kirvalidze looking somewhat distracted and unwell, scrolling through his smartphone and wiping his brow. At at least one point during the event, Kirvalidze had to leave the room. He later explained to the audience that he was feeling ill: “I’ve been a victim of unsafe food this morning. I got an egg in the hotel, and really it’s terrible.”

Several European diplomats denied seeking to derail Kirvalidze’s candidacy.

“This is absolutely not the case,” one European diplomat said. “There definitely was no smear campaign. We ran a positive campaign. We ran for a candidate, not against any candidate.”

But in the weeks leading up to the vote, France made a play to persuade the United States to get Kirvalidze to withdraw from the race.

“The French were very aggressive in trying to push the Georgians out of the race,” said the source who was directly involved in the race. “They felt that this was rightfully theirs.”

Two weeks before the vote, the French met with Moley and suggested that the Georgian candidate withdraw from the race, arguing that he had little chance of surviving a first-round ballot and the West had a better chance of defeating the Chinese if they rallied together, according to sources familiar with the exchange. Moley urged the French to try to make a deal with the Georgians but said Washington would not ask Kirvalidze to step down.

But Kirvalidze wasn’t interested. Georgian officials told the French that they didn’t want any consolation deals, including the possible offer of a senior post at the FAO in exchange for backing out of the race. Kirvalidze, they insisted, would remain in the race as long as he enjoyed U.S. backing.

Kirvalidze did not respond to requests for comment for this story.

Amid all the Western infighting, the Chinese unleashed their own shadow campaign to rack up votes, through a combination of strong-arming and, reportedly, lavish spending for votes. Rumors were rife that they paid for first-class plane tickets and luxury accommodations for foreign officials from smaller developing countries and their families for greater sway over the outcome of the FAO election.

In February, a senior Chinese official, Yang Jiechi, traveled to Cameroon and announced that Beijing would cancel some $78 million in debt, according to CNN. The following month, the Cameroonian candidate for the FAO director-general position, Medi Moungui, who had locked in the backing of the African Union, withdrew from the race. The timing fueled claims of a payoff among Western officials who worked with the FAO and in their mind opened the door for China to pick off African votes.

The Chinese were “essentially buying up anything and everything that was for sale,” said one source involved in the deliberations.

Other current and former U.S. and foreign officials familiar with the race told Foreign Policy that China threatened to block key exports from South American countries, including Argentina, Brazil, and Uruguay, if they didn’t fall in line behind Qu’s candidacy. The ballot was secret, but South American and European media outlets reported that all three countries backed Qu.

Representatives from the Chinese and Cameroonian embassies in Washington did not respond to requests for comment.

Before the vote, U.S. and European delegations picked up rumors that China had instructed its supporters to take a screenshot of their ballots to prove they had voted for Qu. They proposed imposing a ban on the use of cell phones in the voting booth and having U.N. security enforce it. But China, backed by Iran and other supporters, opposed the rule. In the end, they reached a compromise. Cell phones would be barred, but there would be no measures to enforce the ban.

Still, on the day of the vote, FAO security had to “shoo away” Chinese representatives who were trying to peer over the top of the voting booths and take photos, according to two diplomatic sources. And some delegates divulged having taken screen shots of their ballots, according to diplomatic sources.

The FAO did not respond to request for comment for this story.

“There is one narrative that says, ‘Sure, this is all about American incompetence and [the] diminishing influence we have in the U.N.,’ which is true to a point,” said one former U.S. diplomat, speaking on condition of anonymity due to the sensitivity of the subject. “But I do also think that there’s an alarming rise of Chinese hardball tactics and outright bribes that were used.

“It was just a whole messy affair that at the end of the day was a mix of Parisian and Brussels arrogance, with Chinese ambition, and ultimately just showed … how far American influence at the U.N. has fallen.”

Shortly after Moley floated Kirvalidze’s name in January, officials from the U.S. Embassy in Rome, where the FAO is based, pushed back.

They argued that the U.S. strategy was deeply flawed and that the Georgian candidate could not win. The U.S. Department of Agriculture (USDA), which works closely with the FAO, also expressed misgivings about the Georgian’s prospects, according to diplomatic sources.

Some in the U.S. government “were looking at this, and they were just laughing because they knew he didn’t have a chance,” one U.S. official said.

Charles Kupperman, the U.S. deputy national security advisor at the time, emerged as a leading advocate for the French candidate, arguing that Geslain-Lanéelle stood the best chance of winning. Her backers pointed to her background as an agricultural engineer and extensive experience in both French and EU government structures. She also would have been the first female head of the FAO and was the first-ever candidate whom the European Union had collectively backed. But Moley ultimately prevailed.

“She should have won the election,” said the official, who described Geslain-Lanéelle as an “ideal leader” for the FAO. We “talked to dozens of foreign counterparts who made clear they wouldn’t vote for the Georgian.”

“If the U.S. had provided any kind of leadership whatsoever, she would’ve had it.”

But such concerns about the viability of Kirvalidze’s campaign were largely ignored, and the U.S. Embassy in Rome—which was in the best position to lobby delegates who would cast their ballots in secret—soon found itself frozen out of deliberations in Washington on the election, officials familiar with the campaign told Foreign Policy. Those officials said the embassy was pushed aside because they didn’t agree with the State Department’s strategy and were dismissed by officials in Washington when they warned that Kirvalidze had slim chances of winning.

Over the following months, U.S. diplomats in Rome had no clear instructions to lobby on Kirvalidze’s behalf, eliminating opportunities to promote him or rally votes to his side.

One official described an awkward meeting with Kirvalidze back in February. Embassy officials, treating him like any other candidate, peppered the Georgian with questions to test his grasp of international agricultural policy.

Kirvalidze behaved as if he were already the official candidate, and he wanted to know what the United States planned to do to counter the Chinese, whom he accused of bribing other FAO delegates for votes, even though he was unable to provide proof. One official said Kirvalidze displayed a limited understanding of how the FAO operated.

In April, senior diplomats had a chance to quiz all candidates for the FAO director-general position on their leadership and goals that would qualify them for the job during a plenary meeting. At the meeting, Moley engaged in a testy exchange with Qu, pointing to other Chinese nationals who ran international institutions in a manner that appeared to be centered on doing Beijing’s bidding. Moley suggested that Interpol’s chief from 2016 to 2018, the Chinese politician Meng Hongwei, acted on instructions from Beijing and sought Qu’s assurances that he would “make decisions without authorization of [his] government.”

“I am a professional scientist,” Qu responded. “You have to believe my professionalism because I got education from Europe, America, and China.”

Moley also pressed Qu on how he would handle sexual harassment allegations in the workplace if he were elected director-general of the FAO, after a U.N.-wide survey showed staff concerns over sexual harassment issues. “I really do not know how to do it. But I will ask you your advice, OK?” Qu said.

“I think we have our answer. Thank you,” Moley said.

On June 18, just days before the vote, the United States sent a démarche to delegates saying it would vote for the Georgian candidate but encouraging other countries to vote for either the Georgian or the French candidate—but not the Chinese one.

“[O]ur primary objective is to beat the Chinese candidate,” according to the U.S. paper, which was obtained by Devex, a news organization that covers humanitarian and development issues. “Chinese leaders at INTERPOL, the International Telecommunications Union (ITU), and the International Civil Aviation Organization (ICAO) have demonstrated a bias towards Chinese foreign policy and a lack of transparency and accountability.”

“Even by démarche standards, it was a pretty weak one,” said one source involved in the deliberations. To him, it underscored how the United States still hadn’t fully resolved internal rifts over whether to back the Georgian or the French candidate, even after nearly six months of deliberations.

Days before the vote, Moley and Ted McKinney, the undersecretary for trade and foreign agricultural affairs at USDA, traveled to Rome to lead the U.S. delegation.

On June 19, the U.S. ambassador to the FAO, Kip Tom, told his staff that the United States would still be backing the Georgian candidate. Tom, newly confirmed, was just weeks into the job. The vote was in four days.

“Even by démarche standards, it was a pretty weak one.” The French, meanwhile, continued to press their candidate, frustrated at both the Americans and Georgians that they wouldn’t back Geslain-Lanéelle, the only other person capable of challenging the Chinese. In a quintessentially diplomatic sleight, the frustrations turned into a battle of dueling receptions: The Americans organized a reception for Kirvalidze at Tom’s residence the same night that France had previously scheduled a reception in honor of their candidate.

The State Department declined to respond to an extensive list of questions on its role in the election campaign. Instead, a spokesperson for the department provided a general statement to Foreign Policy noting that “the United States supports candidates’ leadership positions in multilateral institutions, including the U.N. Food and Agriculture Organization, who have the necessary professional standing, experience, and management skills to succeed in such positions.”

“They must also demonstrate knowledge of U.S. values and priorities, recognize that those institutions should act in the interest of all member states, and commit to the highest standards of transparency and accountability,” the spokesperson added.

Amid the infighting among Western allies, China’s candidate coasted into a victory that represents an unprecedented defeat for the West in international organizations. When the votes were finally tallied up in the first round, experts following the election were stunned: Qu secured 108 votes, an overwhelming majority that rendered more rounds of voting useless. When Qu was announced the winner, the chamber at the FAO headquarters erupted with applause.

Some diplomats say China simply ran a better campaign, fielded a stronger candidate, and lobbied vigorously on his behalf. China’s case was also bolstered by its extraordinary success in development, having lifted more than 850 million people out of poverty since the late 1970s, according to the World Bank.

But others say the United States’ mishandling of the situation, and its infighting with allies, handed China its victory.

The defeat sent shockwaves through Foggy Bottom, where senior officials had been led to believe that Kirvalidze stood to win at least 60 votes. Such an outcome raised the chances that the campaign would be forced to go into a second round, allowing the United States to negotiate a deal with the French to have one of their candidates drop out. But that outcome never came to be. In the end, Kirvalidze received only one-fifth of the votes the United States believed he could get.

“Nobody was really high on the Chinese candidate. … I think that this is more a case of our complete ineptitude and miscalculation on this than it was the Chinese winning,” one U.S. official said.

“I think we could’ve beaten them, I really do.”