EXCLUSIVE: STX Entertainment will distribute Martin Scorsese’s and Netflix’s The Irishman after all. In China, along with Media Asia. The agreement came as part of a negotiated deal that happened months ago with Netflix after a brouhaha that occurred with distribution rights on the high-profile mob movie that teams Robert De Niro, Al Pacino, Joe Pesci, Harvey Keitel and others for the first time.

In Cannes two years ago, STX slapped down a record-breaking $50 million to take international rights off the table (and away from other bidders) from Mexican financier and Fabrica de Cine’s Gaston Pavlovich, before questions arose about whether the rights were free and clear.

STX has already distributed New Year’s Rockin’ Eve as well as the Golden Globes show in China (in partnership with Tencent). The company recently announced the co-production of Steel Soldiers with Alibaba. But most importantly is the box office success of the Jackie Chan-starring The Foreigner, which was an English-language co-production for STXfilms and Chan’s Sparkle Roll Media. The Foreigner, which STX distributed there, also opened during the coveted Golden Week in China in September, taking advantage of the influx of moviegoers during the National Holiday and going on to gross more than $81M in the Middle Kingdom, a good number for a Chan movie that falls outside his traditional action comedies.

Related Story 'Cheer' Coach Monica Aldama Speaks Out Via Instagram On Jerry Harris Child Porn Arrest

So Netflix’s biggest film to date is likely to be released theatrically in the Middle Kingdom — a territory where the streaming service has no presence other than sublicensing some product to iQiyi, and the biggest in terms of box office outside of North America. It will likely be one of the few theatrical releases for the film as we know Netflix plans to release in the U.S. in about 10 markets and also in the U.K.

There is an expectation that after the theatrical release in China, STX will also partner to handle streaming rights there.

The deal will see China’s doors opened to Scorsese after the filmmaker had once had a film banned there. In 1997, China refused to show his Dalai Lama biopic Kundun because of the politics involved.

It was a tangled web to bring The Irishman to this point over months and months with a series of phone calls, emails and even face-to-face meetings to unravel the complicated rights mess that embroiled Scorsese and De Niro as well as Paramount, STX, Netflix and Fabrica de Cine.

According to sources, after STX made the deal in Cannes, Netflix and Scorsese’s WME agent Ari Emaneul and manager Rick Yorn were told that worldwide rights on The Irishman were free and clear and “fully unencumbered” by Pavlovich, despite the fact STX had already sold off the territories to the tune of $50M and already had secured $30M in tax credits and incentives.

Panic and confusion erupted here and abroad after Netflix began circling to take worldwide rights on the property from Paramount Pictures. The question was, how could that occur given that STX wrangled away international rights in Cannes from bidders Universal, Fox, Lionsgate, IM Global and Alex Walton’s Bloom?

At the time of the deal, Pavlovich said on the record: “We value STX’s passion and belief in this project. Seeing the dynamism of their team, the experience of their senior executives, and their shared vision for creating powerful content, we decided to entrust STX Entertainment with The Irishman as the best possible partner to handle the international distribution for this project … ”

And there were no arguments. After all, STX’s new international president David Kosse (while at his former post at Universal) oversaw international sales on Scorsese’s The Wolf of Wall Street, which pulled in $275.1M internationally, marking the biggest opening ever for Scorsese abroad.

But then Fabrica was stung on the dismal performance of Scorsese’s Silence (which it financed) and wanted out, we heard. The STX deal was joined at the hip with Fabrica. What circulated in town after the Netflix interest emerged is that STX got ahead of itself and didn’t actually have the rights.

Fabrica claimed there was “no paper” between itself and STX. However, apparently, there were emails (including from Fabrica’s own lawyer), and also what showed up, we were told, was a fully-executed term sheet and an offer from Fabrica in helping to secure some sub-distributors as well as Fabrica helping to structure foreign deals. There seemed to be a that some deal had been agreed upon even if there was no signed contracts.

After Netflix’s interest in worldwide rights hit the press, that’s when the lawyers between companies started talking to each other and the international partners who had signed deals wondered what the heck was going on. At that point, there was no deal for Scorsese in place to direct and no agreed upon budget. STX had no answers and was said to be equally confused. It got very heated at one point (to put it mildly) with the foreign distributors. Meanwhile, WME and Yorn continued to negotiate with Netflix — and why wouldn’t they considering they were told there were no deals in place with STX.

Once all parties began talking and the trail of paperwork emerged, we were told, Fabrica came forth and asked to be (released) from any possible litigation. STX was asked if it would want to finance the entire thing; the company ran the numbers and decided against it.

And it goes on from there, with Scorsese and De Niro, at one point, personally involved in the negotiations at the end of April of last year after one foreign distributor refused to give in and step aside. After some tidy make-goods were promised, it was agreed to move The Irishman out of STX and onto Netflix.

At the end, it worked out to the mutual benefit of all parties including Fabrica and Pavlovich as he is still a producer on the high-profile project which could end up as one of Scorsese’s best.

At the end of the negotiations, Netflix won distribution everywhere but China, which STX and Media Asia will handle.

And this movie is a plum for Netflix, which was said to have committed to dropping the reported $125M into Scorsese’s lap to produce this film and gave the filmmaker a big payday (we heard around $10M and up to $15M+). The film is getting ready to wrap and still has to be edited and special effects are still to be done to reverse the ages of the actors. We are now hearing from multiple sources that the film’s budget is well over $125M and more in the $140M range (and climbing).

It is also sure to be a game changer in the industry and is likely to be a strong Oscar contender — how can it not with the high level of talent and a film being done by a master?

Netflix received a total of eight Oscar noms this year — the most so far for the streaming company — including four for Mudbound.

None of the parties involved would comment.