Writing in Fortune magazine two weeks before the 2016 election, Donald Trump’s old friend and fundraiser, Thomas J. Barrack, outlined a new U.S. policy for the Middle East. The “best hope” for America and the Arab world, he said, was U.S. support for the new, “brilliant young leaders” in places such as the United Arab Emirates and Saudi Arabia.

Barrack, who would soon become head of the president-elect’s inaugural committee, was already acting on behalf of one of those leaders, Abu Dhabi Crown Prince Mohamed bin Zayed, the de facto ruler of the United Arab Emirates, according to a federal indictment unsealed against him in California on Tuesday.

Charged with failing to register as a foreign agent and lying to the FBI, Barrack allegedly used his close relationship with Trump to push UAE-sought actions on both the campaign and during the first two years of the administration. The Fortune op-ed was the product of direct input from Emirati officials, the indictment alleges.

Barrack’s lawyer has said he will plead not guilty. The indictment includes references to dozens of emails and texts between him and his alleged co-conspirators — Matthew Grimes, an employee of Barrack’s investment firm, Colony Capital, and Rashid al-Malik, a UAE citizen with close connections to the Emirati royal family.

Others in Trump’s orbit may have influenced the president’s decisions on Middle East policy. But what is clear from the indictment is that Barrack and the other indictees claim credit for virtually every interchange between Trump and the UAE, whose government quickly became a Trump favorite.

Some of the purported victories were small. When, as a candidate, Trump was preparing an early 2016 speech outlining his energy policy, Barrack allegedly prepared a draft for the campaign including a favorable mention of bin Zayed.

The proposal seemed jarring, since the speech was to outline Trump’s plans to build domestic energy production and end oil imports from countries such as the UAE and Saudi Arabia, both leading members of the Organization of the Petroleum Exporting Countries.

When he delivered the address, Trump confusingly followed a vow to “become, and stay, totally independent of any need to import energy from the OPEC cartel” with a promise to “work with our gulf allies to develop a positive energy relationship.”

Emirati Official 1, the indictment reads, watched Trump’s speech and emailed Barrack his congratulations through an intermediary. That official reported that “everybody here are happy with the results.” Further mentions of Official 1 in the indictment make clear that he is bin Zayed.

During the summer of 2016, Barrack, “acting at the direction of United Arab Emirates officials,” helped draft a strategy for the UAE to “promote its foreign policy interests and increase its political influence in the United States,” the indictment alleges.

He is said to have discussed the plan with UAE officials during an August meeting in Morocco, just weeks after speaking at the Republican National Convention, where Trump was nominated for the presidency.

“I’m here because Donald Trump is one of my closest friends for 40 years,” Barrack told the delegates at the convention.

Barrack had long had investments and contacts in the Middle East, particularly in the Persian Gulf. The purpose of the strategy proposal, according to a December 2016 email quoted in the indictment, was “to achieve outsized financial returns,” as well as to “garner political credibility for [UAE] contributions to the policies” of the recently elected U.S. president.

Days after Trump’s inauguration, the three indictees exchanged messages about arranging a phone call between Trump and bin Zayed. In an email after the two leaders spoke, Grimes indicated that Barrack had been instrumental in setting up the conversation and proclaimed, “We can take credit” for it.

Bin Zayed visited Trump in the White House that May, with Barrack telling the Emiratis he helped set up the meeting and briefing them afterward on “lots of info” garnered during it, according to the indictment.

When Mohammed bin Salman, a bin Zayed ally and the new Saudi crown prince, also visited Washington that spring, Barrack advised the Emiratis that he had “forced” the White House to “elevate” what had been planned as an informal handshake to a formal lunch with Trump.

Most prominent among the policy impacts of Barrack’s alleged lobbying are events preceding and following the decision of Saudi Arabia and the UAE to break relations with Qatar, also in 2017.

During Trump’s May visit to Saudi Arabia — his first overseas trip as president — UAE and Saudi rulers bent the president’s ear, charging that Qatar was a primary supporter of global terrorism and was inciting rebellion against their governments. The allegations reflected decades of disagreement among the three Persian Gulf neighbors over a wealth of issues.

The spark that led to the severing of relations, just days after Trump’s departure from Saudi Arabia, was an incendiary quote, supposedly by the Qatari emir, praising Iran and Hamas. Posted on Qatar’s official news website, the statement was later determined by U.S. intelligence agents to be the product of a UAE-orchestrated computer hack.

But Trump immediately jumped on the charges as justified, taking credit for the breach between the gulf countries and saying he knew all about Qatar’s terrorist involvement.

His then-secretary of state, Rex Tillerson, and then-Defense Secretary Jim Mattis were horrified that Trump would so directly attack a crucial ally.

Qatar is home to the U.S. Central Command headquarters in the region, hosting Al Udeid Air Base and thousands of U.S. troops. And Qatar’s hands are considered no more dirty than those of the others where support for terrorists was concerned.

Grimes, according to the indictment, had conveyed UAE talking points to Barrack to use with the White House in supporting the UAE criticism of Qatar.

But by early September, Trump’s own officials had persuaded him to change his position, and he publicly stated he might have to bring the parties to the White House and negotiate an end to their differences.

According to the indictment, Barrack advised the Emiratis that the president was considering calling the squabbling leaders to Camp David, an event none of them wanted. The idea was later dropped.

On or about Oct. 13, 2017, al-Malik created a telephone note with a draft message to UAE officials following a conversation with Barrack, the indictment reads. Barrack, he wrote, reported that several senior U.S. officials were trying to convince Trump “that Qatar is a victim! And that all of the other countries (Saudi, UAE) are also funding [terrorist] groups!!!”