NEW YORK (AP) — As wealthy financier Tom Barrack built a private equity empire that relied on his close contact with Middle East leaders, he encountered a stumbling block: his friendship with Donald Trump.

Barrack had known Trump for years and admired him. But the Republican former president’s anti-Muslim rhetoric during his 2016 campaign was, in Barrack’s words, a foreign policy “nightmare” that worried some of his biggest investors.

It was a quandary that Barrack, the onetime chair of Trump’s inaugural committee, has sought to explain this week while taking the witness stand on his own behalf at his criminal trial in New York City. Federal prosecutors have accused him of secretly working as a foreign agent who was under orders by the United Arab Emirates to manipulate U.S. foreign policy in its favor.

In his second day of testimony Tuesday, Barrack described efforts to arrange for Trump to meet with UAE national security advisor Sheikh Tahnoun bin Zayed Al Nahyan and other officials from more moderate oil-rich Persian Gulf states to persuade Trump to tone down his “outrageous claims” about alleged threats from the Arab world.

“I was trying to get common ground, to try to get him to step back from what he didn’t believe,” Barrack said.

Barrack also repeated his assertion that he wasn’t hiding his activities. He and his lawyers say Trump campaign manager Paul Manafort and Jared Kushner, the president’s son-in-law and advisor, were fully in the loop.

Asked repeatedly if he ever “offered his services as a foreign agent” for the UAE, Barrack responded, “No.”

The only goal was to create a climate of “understanding and tolerance,” said Barrack, an Arabic speaker of Lebanese descent. “I was so excited that I could be some minor prod in that process.”

On Monday, Barrack testified that he met Trump in the 1980s while helping negotiate Trump’s purchase of the renowned Plaza Hotel. He said he grew to view Trump as “more resilient than anyone I knew.”

During jury selection, U.S. District Judge Brian Cogan cautioned prospective jurors that Trump’s name would come up often, and pressed them on whether they could be fair in a case infused with politics and shadowy international business dealings. Some potential jurors were dismissed after saying it was asking too much because of their distaste for the former president.

Barrack, 75, is accused of using his “unique access” as a longtime friend of Trump to provide confidential information about the Trump administration to the UAE to advance the Emirates’ foreign policy and business interests. Prosecutors say that UAE officials rewarded Barrack by pouring millions of dollars into his business ventures.

Barrack has pleaded not guilty to acting as an unregistered agent of a foreign government, obstruction of justice and making false statements. His lawyers have denied he did anything underhanded.

The Los Angeles-based billionaire has known Trump for decades and played an integral role in the 2016 campaign as a top fundraiser at a time when many other Republicans were shunning the upstart candidate.

The government rested its case last week. Much of the evidence focused on emails and other back-channel communications between Barrack and his high-level leaders in the UAE and Saudi Arabia. Prosecutors say those communications show how Barrack and his contacts schemed on how to win over Trump.

Before being indicted, Barrack drew attention by raising $107 million for Trump’s inaugural celebration following the 2016 election. The event was scrutinized both for its lavish spending and for attracting foreign officials and businesspeople looking to lobby the new administration.

Barrack’s testimony is to continue Wednesday.