For the past several years, Ari Emanuel, the Hollywood impresario who serves as chief executive of William Morris Endeavor, has been keenly interested in Saudi Arabia.

Emanuel, according to two people who know him but were not authorized to speak on his behalf, was taken by how an apparent reform-minded leader like Crown Prince Mohammed bin Salman might introduce democratic values to the kingdom. Equally important, that reform offered a new distribution pipeline for Endeavor’s growing portfolio of entertainment assets, which include not just a talent-agency megalith but a live-event business, the mixed-martial arts league UFC and a growing content-development arm.

Emanuel was so transfixed with Mohammed bin Salman that he courted, and in the spring accepted, a $400 million investment in Endeavor from Saudi Arabia’s Public Investment Fund, trading an undisclosed company stake in exchange.

That fascination has now screeched to a stop. Under pressure to cut ties in the wake of the disappearance of Washington Post journalist Jamal Khashoggi at the Saudi Consulate in Istanbul two weeks ago, Emanuel and his team have reached out to PIF to return the money and reclaim the stake, according to a person familiar with the talks who was not authorized to speak about them publicly. The company declined to comment.

Regardless of what comes next for the Endeavor-Saudi partnership, though, the investment offers a window into the preoccupations a capital-hungry Hollywood has with wealthy new entrants — not to mention the risks of doing business with them, especially when they’re tied to foreign regimes.

“If you’re a big player in the entertainment business, you see the Middle East as a growing market, an attractive place both to receive investment and promote film interests,” said Shadi Hamid, an expert on Saudi Arabia and the Middle East at the Brookings Institution. “And I think what we’ve seen over the past 13 days is the danger of ignoring the warning signs — of what happens when the red flags become redder.”

Entertainment is far from the only industry to make now-questionable deals with PIF. But its high-profile status and historical willingness to turn a blind eye to the sources of its funding offers a vivid example of these deals’ underbellies.

For Emanuel, the brother of Chicago Mayor Rahm Emanuel, the PIF deal represented a leap of faith that Mohammed bin Salman would make good on his reformist rhetoric. But while that leap was initially lucrative, its risks are now on full display.

As of early last week, Emanuel, reading coverage of Khashoggi’s disappearance, began having second thoughts and reached out to PIF to seek to unwind the deal, according to a person familiar with the talks.

Such a feat won’t be easy. The money has already largely been spent, paying down debt on the UFC acquisition and other purchases of smaller agencies, as Endeavor has been on a buying spree in recent years. PIF also has legal rights as an investor and could sue Endeavor for reneging on the deal; such fears have kept the company publicly quiet despite mounting pressure.

“Unwinding a deal like this is a lot easier said than done,” said Jonathan Bender, a partner at the law firm Wilk Auslander who specializes in investments and mergers and acquisitions. “There are protections generally for the investor that, unless there’s a very specific out clause Endeavor put in when the deal was made, will be difficult to remove.”

The only likely way out of the deal for Endeavor, he said, would be to pay a premium above the $400 million, a situation that gives Saudi investors a lot of leverage.

Endeavor would also need to raise new capital if the deal was revoked. And while experts say that won’t be difficult given the money currently flooding Hollywood — Endeavor rival United Talent Agency recently had many suitors to finance its expansion efforts — it will require the labor-intensive creation of a new financing model for the company.

Emanuel has long been willing to thrust himself into sensitive and controversial realms, bringing to the fore Hollywood’s long-standing struggle to balance principle and profit.

Emanuel disavowed then-agency client Mel Gibson in a trade-newspaper ad in 2006 after Gibson went on an anti-Semitic rant during a police stop. But after a reconciliation at a Hollywood party a decade later, he reversed course and has advocated in the past year for Hollywood to reconcile with the actor-director.

When Mohammed bin Salman made a three-week barnstorming trip to the United States last spring to position himself as a reformer and globalist, Emanuel was key to the Los Angeles leg, which included a visit with Democratic Mayor Eric Garcetti. He facilitated several meetings and, with film producer Brian Grazer, co-hosted a party at Grazer’s home for entertainment luminaries such as director Ron Howard, Disney chief Robert Iger, Washington Post owner Jeffrey P. Bezos and former Laker star and newly minted Oscar winner Kobe Bryant. Human-rights issues, such as the monarchy’s crackdown on political dissidents, were not on the agenda, per reports from the event; instead the group mostly discussed lighter topics like the social media habits of Saudi youths.

According to a person who knows Emanuel, the PIF investment was not just about the money or market but a broader opportunity for Hollywood to support potential reformers in a country long lacking in them.

At a meeting of senior Endeavor staff around the time of the visit, Emanuel made his case to some of Hollywood’s most influential agents. He offered an impassioned defense of Mohammed bin Salman as a reformer and explained the company’s move as both good for business and for world democracy, according to a person who was present but not authorized to talk about it publicly.

Not all in Los Angeles were on board. A handful of protesters from the Code Pink activist organization attempted to enter Endeavor’s headquarters in Beverly Hills during the crown prince’s visit but were escorted outside, where they continued to protest.

“Hollywood is super-authoritarian about this, more than any other industry we’ve dealt with,” said Jodie Evans, one of the founders of Code Pink, a feminist-oriented group that opposes what it says are repressive regimes around the world and U.S. support of them. “They’re almost as bad as the Saudi Consulate. There’s no kindness; no listening.”

Medea Benjamin, another founder, told The Post that “people in Hollywood are not dumb. They know it’s a monarchy with no pretense of economic or political rights. They were just enticed by petrol dollars.”

The group had also reached out to try to dissuade AMC, the American movie-theater giant that in the spring opened the first cinema in the kingdom in 35 years after the monarchy lifted a ban on them. The first movie shown was “Black Panther,” the Marvel superhero hit that, with its Afrocentric alternate history, has become a rallying cry for progressive cultural interests.

The Saudi government also sponsored a so-called hospitality pavilion last May at the Cannes Film Festival, where participants sought to further a cultural dialogue with the kingmakers of the global entertainment business. According to a senior film-business official who attended the pavilion, the venue was high on cultural exchange with little talk of finances, a spirit that to supporters showed the benefits of cultural openness but to critics might suggest a troubling normalization.

Mohammed bin Salman’s efforts are part of Vision 2030, a Saudi initiative that seeks to make the historically closed kingdom more open to Western influence — and, consequently, less economically reliant on oil profits. This has happened despite human rights activists objecting to Saudi bombing campaigns in Yemen and its policies that place stringent restrictions on women’s rights to participate in public life, as well as invoking the fact that the majority of the Sept 11 hijackers were Saudi nationals.

But most leading Hollywood figures were silent or actively enthusiastic about Mohammed bin Salman’s wooing last spring. Though Hollywood is overwhelmingly liberal, the support was bipartisan: Fox mogul Rupert Murdoch hosted a dinner at his Bel Air estate that brought together the crown prince and his team with A-list Hollywood executives and stars, such as director James Cameron, TV executive Peter Rice and action-star Dwayne Johnson. At the dinner, Mohammed bin Salman gave a speech underlining reform efforts and the importance of American-Saudi cooperation, which was warmly received in the room, according to reports from the event.

A scrapped Endeavor deal also is unlikely to convince some critics that Hollywood is really eager to end its coziness with repressive regimes; instead, it will reinforce their belief that entertainment titans act only when the heat lamp has been switched on. “It’s fair to wonder where everyone was six months ago,” Brookings’s Hamid said.

A scattered few in Hollywood on Monday were similarly unwilling to see the reversal as anything more than a public relations move. One senior person in the representation business noted many dubious sources of financing. The film fund Red Granite, which financed the 2013 hit “The Wolf of Wall Street,” was accused of using in excess of $100 million from IMDB, a Malaysian development fund connected to the demise of former Malaysian prime minister Najib Razak, whose stepson ran Red Granite.

Toronto Film Festival attendees also attended a 2008 party hosted by Saadi Gaddafi, the third son of the former Libyan strongman, for the former’s new production company. Champagne flowed and 50 Cent gave a private performance.

And Hollywood personalities have had an erratic relationship with the industry mainstay Beverly Hills Hotel, sometimes avoiding and sometimes patronizing the iconic west Los Angeles spot despite a years-long boycott made in protest of one of its owners, the Sultan of Brunei, imposing sharia law on his island nation.

On Monday, as his lawyers were negotiating to undo the deal, Emanuel himself was in Cannes, at the Mipcom TV conference, where in a public address he noted he was “personally really concerned.” Citing legal restrictions, he kept his comments to “We’re monitoring the situation.”

Artists say progress requires an active role. “We are not where we were in 2013; the question is being asked and not being overlooked,” Haifaa al-Mansour, a Saudi filmmaker who with 2012’s “Wadjda” made the first-ever professionally produced feature film by a Saudi woman, told the LA Times last year.

But Mansour, who now lives in Los Angeles with her family, added that this shouldn’t be mistaken for true change. “It also worries me why there hasn’t been more. As a woman I want to see more. As a human I want to see more.”