Woody Allen arrives for the screening of "Cafe Society" and the opening ceremony of the 69th annual Cannes Film Festival in Cannes, France, on May 11, 2016. Allen has sued Amazon for $68 million for allegedly reneging on a deal. (Julien Warnand/EPA-EFE/REX)

When Woody Allen announced a creative partnership with Amazon three years ago, he had a quippy take on how matters would unfold. “Like all beginning relationships, there is much hope, mutual affection and genuine goodwill,” he said in a statement. “The lawsuits come later.”

On Thursday, his prediction came true. Allen sued Amazon for $68 million, alleging in a New York court filing that the company was illegally reneging on an agreement to release his new movie, “A Rainy Day in New York,” and backing out of a deal to finance three other pictures because of negative attention over an allegation that he molested his adopted daughter in 1992. Allen, who denies the allegation, is seeking the money he says was promised, along with damages and court costs.

But the issue goes beyond a powerful company and an Oscar-winning filmmaker fighting over money. What the Allen-Amazon lawsuit reveals, experts say, is a powerful question that much of the business world and particularly Hollywood has yet to digest: What happens to existing relationships when social attitudes shift?

“It’s a fascinating question — most cases of morals and contracts are about what happens in the future. But this is about what happened in the past. And not only what happened in the past, but where everybody knew what happened in the past,” said Jonathan Bender, a partner at the New York law firm of Wilk Auslander who has worked with celebrities and corporations on contract issues. “And it seems to be affecting Hollywood most.”

The question stretches to a number of recent entertainment-world controversies, including the decision by Oscars producers to withdraw a hosting offer for Kevin Hart after the surfacing of homophobic comments he made from 2010 and 2011, as well as Disney’s about-face on bringing back James Gunn to direct a third “Guardians of the Galaxy” movie because of jokes about rape and child abuse he made from 2008 to 2012.

In both cases, the personalities’ offensive tweets that prompted the change were in plain sight for any vetting authorities to see at the time the offers were made. What changed, instead, were public attitudes and attention.

And how institutions should balance their commitments to talent with the responsibility for a new social awareness is a question, industry experts acknowledge privately, they have yet to answer.

Allen has been accused by adoptive daughter Dylan Farrow, now 33, of molesting her when she was 7. The allegation has drawn more attention in recent years with columns written by Farrow in 2014 and later her brother, investigative journalist Ronan Farrow. Scrutiny on Allen also increased with the rise of the #MeToo movement, which caused a slew of Hollywood’s top talent to say they would stop working with him, including “Rainy Day” stars Rebecca Hall and Timothée Chalamet. Allen has denied the allegations.

Amazon executives declined to comment for this story. Allen’s agent and publicist also declined to comment.

Allen’s deal with Amazon was a lucrative one. After earlier agreements for a television series and two other movies made with Amazon Studios’ former chief Roy Price — who was later ousted in the wake of sexual-misconduct allegations — Allen then struck the four-film deal with Price and the digital company. (Amazon founder and chief executive Jeffrey P. Bezos owns The Washington Post.)

The pact was a boon for Amazon, which was in search of filmmaker currency at a moment when streaming services were seen as a second-class option.

It also was a boost to Allen’s standing. The director had, in this era of blockbusters, scrambled to raise funds, in recent years resorting to a patchwork system that included hop-scotching across Europe to capitalize on various countries’ film-rebate programs. The idea that Amazon would pay Allen large sums — one of the films would entail a payment of at least $25 million to Allen’s production company, according to the complaint — and guarantee distribution for four movies was deeply attractive.

But after releasing the film “Wonder Wheel” to dismal box office results in the shadow of the emergent #MeToo movement in late 2017, Amazon appeared to have had second thoughts. The company had initially postponed “Rainy Day” from 2018 to 2019, a move to which Allen says he agreed.

Then, last June, Amazon told him it would be terminating the agreement, according to the complaint, including permanently shelving the movie. Amazon Studios had also undergone a regime change since the release of “Wonder Wheel,” with former NBC executive Jennifer Salke named to replace Price a year ago.

Allen and his representatives tried to see whether a solution could be worked out, deciding in the fall that a lawsuit was the best option, according to a person familiar with the situation who spoke on the condition of anonymity because not being authorized to talk about the matter publicly.

Amazon, the complaint said, had “no legitimate ground . . . to renege on its promises."

Instead, the complaint noted, “defendant’s counsel merely made the vague statement that Amazon Content’s performance of the [agreement] became ‘impracticable’ because of ‘supervening events, including renewed allegations against Mr. Allen, his own controversial comments, and the increasing refusal of top talent to work with or be associated with him in any way.’”

One potential defense for Amazon is “frustration of purpose,” a doctrine that says a contract can be voided if the initial goal is no longer viable — if a house burns down while a party is in contract to buy it, for instance. In Amazon’s case, the company could argue that the unwillingness of stars to come aboard future Allen pictures — or conduct publicity for the one already finished — could potentially fall under that category.

But the law may be on Allen’s side, experts say.

“’Frustration of purpose’ is a tough argument for Amazon to make because the allegations were already out there when they made the deal,” said Melanie Leslie, dean of the Benjamin N. Cardozo School of Law in New York, emphasizing that she was evaluating the question on legal, not moral, grounds. “It’s hard for the company to say they didn’t realize what would happen — all they could say is that ‘market forces changed.’”

“And,” she added, “that’s just saying you made a bad deal. It’s not grounds for invalidating a contract.”

In Hollywood offices, a debate swirled about what the suit might mean for the larger entertainment community.

A high-ranking staffer at a talent agency said that a more morally aware age meant companies had maximum latitude, and even an obligation, to void deals with people whose conduct they find incompatible with their values.

“Amazon did what they had to do — they couldn’t keep working with him, and they shouldn’t have to be forced to because of an old agreement,” the person said, speaking on the condition of anonymity because of the sensitive nature of the subject.

But some disagreed, saying the lawsuit highlighted how companies needed to find ways to honor existing deals no matter the public-relations fallout.

“If they’re not releasing the movie, they need to pay him out and let him release it elsewhere,” said a senior member of a top management firm, also speaking on condition of anonymity because of the charged nature of the topic. “To not do that sets a very dangerous precedent for the creative community. It means anyone could walk away from a deal without paying because the person is experiencing bad publicity. Where do you draw the line?”

That person and others with whom The Post spoke pointed to the case of Gunn, who they think was fired too quickly by Disney executives they say were more concerned about burnishing a family-friendly image than about the specifics of the director’s alleged offenses.

Thursday’s lawsuit has the potential to put both Amazon and Allen on tricky publicity ground.

For Allen, it means dragging back into the spotlight an allegation from which he has consistently tried to distance himself, telling a reporter in 2016 that “I never think about it. The whole thing — it doesn’t bother me. I don’t think about it. I work.”

Amazon executives, meanwhile, could be in their own delicate position of having to argue in a public lawsuit that they could have not foreseen that people would be upset about alleged sexual abuse.

Still, some PR veterans say that is preferable to the alternative. The decision to confront Allen legally instead of paying him, they say, may be as much a reputational move as anything else.

“It certainly doesn’t look good for Amazon to have to give money to Woody Allen,” said Kara Alaimo, a global PR expert who has written a book on the subject. “But it looks better if a judge made them do it than if they pay of their own volition.”

Other recent Hollywood controversies did not come to a head in the same way as Allen’s. Gunn apologized quickly, which rallied fans and some of the film’s stars to his side. Disney-Marvel did not rehire him but will use his script.

Hart declined to apologize but said he had “grow[n]” since then. Ellen DeGeneres, a leading LGBTQ figure, publicly vouched for him.

That appeared to cushion the PR damage: A Hart movie released a week later would turn out to be a hit.