NEW YORK —Thomas J. Barrack Jr., a billionaire who is one of President Trump's oldest friends, had spent weeks trying to smooth the way for a May presidential meeting in Saudi Arabia with Arab leaders of the Persian Gulf.

All initially went well. Trump praised Qatar — where Barrack, who is Arab American, has deep business ties — as a "crucial strategic partner." Then Trump reversed course a few weeks later and attacked Qatar as "a funder of terrorism at a very high level."

Barrack was taken aback that the president was intervening in a regional dispute. So he did what few others in Trump's orbit have done: He told the president, in effect, that he was wrong.

"You don't need to get involved," Barrack said he told Trump. The president heeded his friend's advice, met with the emir of Qatar and in September offered to mediate.

Few people are closer to Trump than Barrack, his friend for three decades. Barrack helped rescue Trump's real estate empire years ago. He was the top fundraiser for Trump's 2016 presidential campaign. He turned down a Cabinet offer, preferring to be an outside adviser, although his name is still mentioned as a potential White House chief of staff should Trump decide to choose a new one. Above all, Barrack has remained unfailingly loyal to Trump, whom he sees as a shrewd politician.

But even as he remained a close friend and frequent confidant, Barrack has also been disappointed by aspects of Trump's performance.

Barrack, in interviews with The Washington Post, said he has been "shocked" and "stunned" by some of the president's rhetoric and inflammatory tweets. He disagrees with some of Trump's proposals, including his efforts to ban immigrants from certain Muslim countries and his push for a border wall with Mexico. He wonders why his longtime friend spends so much of his time appealing to the fringes of American politics.

"He thinks he has to be loyal to his base," Barrack said. "I keep on saying, 'But who is your base? You don't have a natural base. Your base now is the world and America, so you have all these constituencies; show them who you really are.' In my opinion, he's better than this."

"I tell him all the time: I don't like the rhetoric," Barrack, who runs a large real estate investment company, said at his Manhattan office.

Trump's relationship with Barrack is one of the most important, if little understood, of the president's life, offering a case study of what it takes to remain close to him in a time of such turmoil.

The men have struck a mutually beneficial deal. Trump solicits Barrack's advice regularly, asking how his actions are playing with the public. Barrack listens deferentially, advises Trump to change course without fear of retribution, and retains a bond that has outlasted Trump's many personal and financial crises.

Barrack said he has often thought about how he has remained a close friend for 30 yearswith a man whose "reputation is selfish and egotistical. Here's what I think the answer is: I've never needed anything from him. . . . I was always subservient to him."

Barrack said that his life intersected with Trump "at soft moments," such as discussions about their divorces and children. He was at Trump's side during the funeral of Trump's father, Fred, and they talked for a half-hour about "the weight of a hard dad and the baton passing." As a result, Barrack said, he has seen within Trump "a kind of compassion at a very lonely level."

Out of that has developed a most unusual bond, which in turn has enabled Barrack to talk to Trump "straight up," telling him when he disagrees. That has been surprisingly often.

"It is not always fun, and, no, he doesn't come back and say, 'By the way, your idea was right or brilliant,' " Barrack said.

From left: Thomas J. Barrack Jr., Miriam Adelson and Sheldon Adelson greet Donald Trump, then the president-elect, before his inauguration at the U.S. Capitol on Jan. 20. (Chip Somodevilla/Getty Images)

But Barrack can't be fired, even if his advice doesn't pan out, as has happened.

It was Barrack who persuaded Trump to hire political operative Paul Manafort — whom Barrack first met in Beirut 40 years ago — for the presidential campaign. Trump never publicly criticized Barrack for the advice, even as Manafort came under investigation by special counsel Robert S. Mueller III in a probe examining whether the campaign colluded with Russia.

The 70-year-old Barrack, who travels the world by private jet and yacht,speaks in a measured cadence with a diplomatic tone. He says he always couches his advice to Trump in an understanding way. Others said that Barrack has mastered the art of stroking Trump's ego. Either way, the two usually talk at least once a week.

Barrack believes that Trump suffers by having too many "yes men" around him. The conclusion is surprising, given Trump's penchant for attacking anyone who disagrees with him.

"No, he is very good at being told he is wrong," Barrack insisted when pressed on this point. "People don't have the courage to do it. He pushes back hard, but the people he respects the most are the people who have the most refined and not wimpy point of view."

As Barrack's bluntness and closeness to the president have become better known, he is sought as a conduit to Trump for sensitive conversations. "I've talked to him about things that I've thought he would be a good person to talk to the president about," said Sen. Roy Blunt (R-Mo.), who got to know Barrack through their work on the 2017 Presidential Inaugural Committee. "Tom Barrack has a capacity to disagree that others might not have."

For example, Blunt said he thought Barrack "was the best person to explain to the president that the challenges he is facing aren't unique."

Barrack said Trump listens to his and other views, "curates" them and sometimes tells him: "I love you, but if I listened to you, I'd still be on 'The Apprentice.' "

Trump was born into wealth, but Barrack's upbringing hardly presaged that he would become a fellow billionaire. His paternal grandfather was a Christian émigré from a city called Zahleh that at the time was part of Syria and today is within the borders of Lebanon. Barrack's father ran a small grocery store in Culver City, Calif., and the family was raised in a modest home in the shadow of MGM Studios.

Barrack became a lawyer, and his ability to speak Arabic led to an assignment in 1972 to go to Saudi Arabia to work on a gas deal. Barrack played squash with a local Saudi. Soon the Saudi brought his brothers. It turned out they were all sons of the king of Saudi Arabia. Barrack spent many hours listening to the Arabs discuss their world, which he said gave him "great respect for the society and community."

The princes, in turn, hired him, and he became, as he put it, the American representative of "the boys."

A roommate at Barrack's Beirut apartment introduced him to Manafort, who represented a firm doing business with a Saudi construction company. They became close friends and, four decades later, Barrack persuaded Trump to hire Manafort for his presidential campaign.

Barrack's success representing the Saudi princes enabled him to buy a California ranch in 1979, just down a hill from Ronald Reagan's Rancho del Cielo estate in California. The Secret Service later boarded horses at Barrack's ranch, and he occasionally went on trail rides and sat around campfires with Reagan. "I loved him," Barrack said of Reagan.

Barrack first came to national attention in 1982 as a deputy undersecretary to Interior Secretary James Watt, a controversial Cabinet member in the Reagan administration who later announced his resignation while at Barrack's ranch.

Later, Barrack became entangled in controversy after he gave $70,000 to a person who bought the house of Reagan counselor Edwin Meese and then forgave the loan. Barrack was called before Congress to answer questions about whether his Interior appointment was a quid pro quo. An independent counsel found that there was "no evidence" Meese was aware of Barrack's help.

The experience convinced Barrack that he never wanted to serve in public office. "They kill their own in Washington," Barrack said.

Hired by the wealthy Bass family of Texas in 1987, Barrack received a phone call to come to Trump Tower to meet a rising star in New York real estate.

Donald Trump wanted to buy a 20 percent share of the Alexander's department store chain owned by the Bass brothers and take over some of the company's real estate. He quickly reached a deal with Barrack to buy the shares.

A year later, Trump set his sights on the Bass family-owned Plaza Hotel, which Trump could see from his office window.

"You have the Plaza," Trump said, according to Barrack. "I want it."

Barrack told Trump that the family wanted $410 million for the property,and Trump surprised him by agreeing to the price in cash. Trump later acknowledged that he could "never justify" the price but said he wanted the trophy property, which he later had to give up as a result of a bankruptcy agreement.

The sale sealed Barrack's reputation as a dealmaker.

"We then created a great personal friendship," Barrack said. "Our lives went along the same cadence. We both got divorced, we both had kids the same age, we both got remarried, and we did different deals together."

William Rogers, a Barrack business partner, said Barrack could tell Trump that he was wrong in a way few others could accomplish. "Donald can be a hard man in his opinions," Rogers said. "Tom had the ability to tell Donald things that he didn't want to hear from other people, in a way that Donald would say, 'Thank you; you're my friend and can say it to me and not offend me.' "

In 1991, Barrack created his own company, Colony Capital, which became Colony NorthStar, of which he is executive chairman. Barrack realized 50 percent profits for the next two years by investing in distressed properties, including some bought from the Resolution Trust, the quasi-governmental entity that sold off property held by failing financial institutions.

Trump was struggling with financial problems in 1994 when Barrack was brought in to help. A banker with Chase Manhattan Bank called Barrack and told him that Trump's portfolio, including a $100 million loan with Chase for a Manhattan development, was in trouble.

"Chase called us in Los Angeles and says to Tom, 'You're the only person who has ever been able to deal with Donald 100 percent, and deal with him reasonably,' " Rogers said. " 'Would you help us with this? Because if he doesn't work with us, it is going to be really, really bad for him.' "

Barrack wanted to help his friend and thought he might invest in the deal.He went on a worldwide search for a backer and got a commitment from "several members" of the Saudi royal family.

Trump ultimately decided to go with investors from Hong Kong. Still, Barrack's intervention had been crucial, persuading Chase not to foreclose and giving Trump time to line up financing.

The two remained close. Barrack hired Trump to oversee renovation of a Park Avenue property. While there are many stories of Trump stiffing or underpaying partners, Barrack said he never had such problems.

By 2005, Fortune magazine profiled Barrack as "arguably the best real estate investor on the planet today." Barrack told Fortune, "I'm getting out" of real estate deals because the market was ready for a crash. Trump was quoted saying, "Tom has an amazing vision of the future, an ability to see what's going to happen that no one else can match."

Barrack's prediction proved true. As the 2007 financial crisis pummeled many real estate investors, Barrack bought up discounted property or debt. He wound up holding part of the debt on a project controlled by Trump's son-in-law, Jared Kushner, who had purchased a 41-story Fifth Avenue office tower at the height of the market and was having trouble making the loan payments. When Kushner tried to restructure his debt — meaning some investors would receive less than expected — he flew to California to get Barrack's support. After Barrack talked with Trump about the matter, he went along with Kushner's request.

Around the same time, Barrack helped Manafort, loaning Trump's future campaign manager $1.5 million to refinance a home in the Hamptons. Barrack said the loan was repaid in 14 months and was the only financial transaction between the two.

Trump and Barrack began talking about the presidency as early as 1987, and the talk grew more serious in 1999. "I used to tell him . . . people don't understand issues and themes; they understand candidates, and they look to see what is in the heart and character of the candidate, and you are great at that," Barrack said.

When Trump announced his candidacy on June 16, 2015, Barrack was shocked by what he said.

Trump said Mexico was sending "rapists" and other criminals to the United States and that he would build "a great wall" that Mexico would pay for.

Barrack thought to himself, " 'Oh my God, where are we going with this? What did he just say?' Which I continue to say, by the way. It is shocking to me that he would talk that way because he is not that way." Barrack said Mexico and the rest of Latin America needs "kisses and hugs" from the president, not divisive attacks. He suggests that Trump change his motto from "Make America Great Again" to a more continental theme of "Make the Americas Great Again."

Another stunning moment for Barrack came when Trump called in December 2015 for a "total and complete shutdown of Muslims entering the United States" until authorities "can figure out what the hell is going on."

Barrack said Trump was trying to pressure Muslim-dominant countries to root out terrorists within their midst. Still, he said that Trump's ban "is one of the things that hit me the hardest because it is the most complex."

Thomas J. Barrack Jr., second from left, and his wife, Rachelle, left, tour a refugee camp in Zahleh, Lebanon. Barrack’s paternal grandfather emigrated from the city, then a part of Syria. (Diego Ibarra Sanchez / MeMo for UNICEF/UNICEF)

Barrack's ancestry fueled his concern. He had often visited Zahleh, the mountain city that his grandfather emigrated from in 1900. The area now houses strings of settlements of Syrian refugees, many of whom barely subsist. More than 1 million Syrians have taken shelter in the country of 6 million people.

Barrack visited Zahleh in May 2016, as Trump's proposed Muslim ban continued to dominate campaign coverage.

Luciano Calestini, who at the time was deputy representative of UNICEF-Lebanon, took Barrack on a tour of several refu­gee settlements. "He had a chance to walk around, talk to refugees and think what it would have been like to grow up there," Calestini said in a telephone interview. "He reflected on how easily that could have been him if his grandfather hadn't moved . . . with no job and destined for a life of just scraping by."

Barrack, speaking about the visit, said he thought about how his grandparents had fled the same area amid sectarian and political strife and how little had changed for those unlucky enough to be refugees.

Barrack said he frequently talked to Trump about the proposed Muslim ban, seeking to explain why the Muslim ban could go over badly in the region.

"The president always viewed me as one of the few Arab American friends that he has," Barrack said. "I'm telling him, 'Look, Islam is the fastest-growing religion in the world. You got 2 billion Muslims.' " If young Muslims can't find jobs, they may turn to terrorism, he told Trump.

Barrack supported Trump's campaign, and shortly after Trump lost the Iowa caucuses, he reconnected with his old friend Manafort, a longtime Republican consultant.

"I really need to get to" Trump, Manafort said, according to Barrack. He told Barrack he wanted to work as Trump's convention manager, helping him navigate what they expected would be a contentious affair.

Barrack, who had long been friendly with Kushner, as well as Trump's daughter Ivanka, said he wrote them an emailurging Trump to hire Manafort.

Manafort soon became part of the campaign's inner circle, rising to become chairman. He joined Kushner and Donald Trump Jr. in a meeting with a Russian lawyer who was said to have damaging information about Hillary Clinton. The meeting is now a focus of Mueller's investigation into whether Russia colluded with the Trump campaign, which all involved in the meeting have denied.

Manafort resigned in August after reports of his ties to Ukraine's former president. He belatedly filed a report under the Foreign Agents Registration Act saying his company had been paid $17 million. Manafort's complicated financial affairs brought him under intense scrutiny, including an early morning FBI raid at his home in Virginia. Mueller's office and Manafort declined to comment.

Barrack said he has not been contacted by the Office of Special Counsel or congressional investigators.

Barrack, meanwhile, stood by Manafort. He invited Manafort to accompany him off the coast of Greece on his yacht. "He got fired, and I felt terrible," Barrack said. "When Manafort called, he was depressed. I said, 'I have got five guys on a boat,' and 'Join us.' He came over, and he spent four or five days figuring out what he would do next."

That loyalty has continued. Barrack hired Manafort's business partner, Rick Gates, as deputy chairman of the Presidential Inaugural Committee and then as director of the Washington office of Colony NorthStar. Gates declined to comment.

Days after Barrack returned from visiting the refugee settlements in Lebanon, he turned his attention to giving Trump's campaign financial help. Trump had first promised to finance his own campaign. But that vow was dropped, and Barrack brought in $7 million at a fundraising dinner at his palatial home in Santa Monica.

Then, in June 2016, Barrack helped found a political action committee, Rebuilding America Now, which raised $23 million. After the election, Barrack served as chairman of Trump's inaugural committee, raising more than $100 million, nearly twice as much as President Barack Obama's record 2009 haul of $53 million.

Barrack sees it as logical that raising a lot of money could translate into a job offer, and that is what happened.

"Yeah, I raised the most money for him," Barrack said. "The inauguration in itself was over $100 million that we had to raise from scratch. So of course he said, 'Would you like Treasury? What would you like to do?' "

Barrack said he told the president he would prefer to be an outsider. Privately, he would be the low-profile Trump whisperer, and, publicly, the Trump explainer.

"In my communities, the financial community, the media community, the entertainment community, they really don't like him, in a visceral way," Barrack said. "So to the extent that I can try to bridge a tolerance, I think I can help him the most."

Barrack insisted that Americans are starting to witness Trump change. "He is learning to govern, deal with the Democrats, building constituencies."

As Trump began his presidency, Barrack saw an opportunity to help reshape Middle East policy, which was one of Kushner's many assignments. Barrack reached out to his friends in the Persian Gulf, some of whom had been put off by Trump's campaign rhetoric about Muslims, and tried to assure them that they could work with the president.

"I tell them I know him personally at a very intimate level and the truth is, his passion and his compassion and his empathy for them is true and is deep," Barrack said, even as he acknowledged that "drawing these hard lines from 6,000 miles away may seem harsh."

Barrack's Arab dealmaking has for years fueled his business, focused on three countries: Saudi Arabia, the United Arab Emirates and Qatar. He's done significant business with all of them, raising the question of whether that could influence his advice to Trump on Persian Gulf issues.

He worked with Saudi Prince Alwaleed bin Talal, the chief executive of a Saudi investment company, to buy the Fairmont Hotel chain. Royal family members in the United Arab Emirates partnered with him in the Kerzner International hotel company, which operates a luxurious hotel called Atlantis, The Palm, in Dubai.

Some of Barrack's most recent and significant investments have been with funds connected to Qatar's royal family. In 2010, he worked with partners including the Qatar Investment Authority to buy the Miramax film studio for $660 million and was named chairman. The purchase brought Barrack full circle from his modest upbringing in the shadow of MGM Studios. He became one of the first studio heads to license content to Netflix, a strategy that he said enabled him to sell Miramax to Qatari investors for four times what he paid for it.

In 2012, a company affiliated with Barrack's firm sold property on Italy's Sardinian coast to Qatar's sovereign wealth fund, which is controlled by the emir and the royal family. Italian officials later launched an investigation into whether the transaction had been arranged to avoid paying $190 million in taxes, according to the Guardian.

Barrack, who has not been charged with wrongdoing, has denied avoiding taxes. A Luxembourg entity that handled the transaction for Barrack's company has paid a settlement of 22 million euros.

Thomas J. Barrack Jr., founder of Colony NorthStar and chairman of President Trump's inaugural committee, speaks to members of the media in the lobby of Trump Tower in New York on Jan. 10. (Anthony Behar/Bloomberg)

Barrack tried to use his Qatar connection to help Kushner, who was searching for financing for the redevelopment of 666 Fifth Avenue, the troubled 41-story office tower Barrack had once invested in. Barrack said he told the former prime minister of Qatar to consider investing in the Kushner Cos. property, but the deal never happened.

At the same time, the Arab nations have poured their sovereign wealth into the investment funds run by Barrack's company. Barrack declined to provide specifics.

Barrack's relationships have been complicated by tensions among the Persian Gulf nations. Saudi Arabia and the United Arab Emirates have led the effort to break relations with Qatar and impose an embargo for its alleged terrorism ties. Qatar, which hosts a U.S. military base with 10,000 American military personnel, says it is a staunch U.S. ally.

Barrack stressed he is not picking one friend over the other. "It should be clear that I am friends and have been partners with all three of these Middle East countries at issue," Barrack said.

Barrack's most public effort to influence policy came in a pre-election Fortune column in which he called for the United States to back a "Marshall Plan" that would aid the poor and said there must be a "radical shift in . . . [U.S.] outreach toward the Arab world."

Barrack introduced Kushner to Yousef al-Otaiba, the influential UAE ambassador to the United States, and the two have spoken regularly. Otaiba declined to comment.

Barrack said he sees no conflict raised by his business dealings and his advice to Trump, saying he is just "trying to be an honest individual that has a lot of experience in the region" and that he would not risk his reputation by trying to use his ties to Trump for financial gain. "My objective is to just try and create a tapestry in which all three of them weave a solution," Barrack said.

Dana Shell Smith, the U.S. ambassador to Qatar from 2014 to June of this year, said, "Tom Barrack is perhaps one of the only people in the world who understands the parties well enough and knows all of them well enough, including our administration, to help bring an end to the crisis."

Notwithstanding the success of Barrack and his administration allies in modulating Trump's view, Saudi Arabia and the United Arab Emirates continue to impose their blockade of Qatar, and the crisis continues.