Manchester by the Sea” is widely viewed as an Oscar front-runner. Critics have embraced the story of a grieving janitor, showering star Casey Affleck and writer director Kenneth Lonergan with superlatives. The tender drama was a sensation when it debuted at Sundance, sparking a bidding war that ended when Amazon Studios plunked down $10 million for the rights.

But the story almost never made it to screen. To begin with, Matt Damon had originally been slated to play Affleck’s part until scheduling issues forced him to drop out. That caused headaches, as Damon is far more bankable than Affleck.

“Casey doesn’t have a ton of bankable stats and Kenny’s a negative,” producer Chris Moore said at a panel discussion Saturday and the Produced By New York conference.

Indeed, Lonergan’s career was at low point. His most recent film, “Margaret,” was entangled in a series of lawsuits as a result of a tortured post-production history. As the release date got pushed back years, Lonergan struggled to deliver a movie that clocked in at the contractually mandated running time. At one point, he even tried to turn over final cut to Martin Scorsese in order to deliver a finished version.

“Kenny is in a certain place right now that he really wasn’t in… his reputation was really sullied,” Damon said on Saturday.

In order to appease the financiers, Damon, and not Lonergan, was given final cut on “Manchester by the Sea.”

“I was the compromise,” said Damon. “It was just a way of keeping everybody calm.”

“Kenny had this reputation of not being able to cut anything down,” he added, noting, “I knew I would never need it.”

The film was ultimately made possible because Kimberly Steward, daughter of billionaire businessman David L. Steward, fell in love with the script and agreed to finance the production through her new company, K Period Media. Steward is the rare backer who believes in giving artists a lot of freedom.

“It has to be his vision,” she said of Lonergan’s film. “I can’t tell him what his vision is.”

“Manchester by the Sea” seems poised to be an indie breakout when it opens in theaters next month. Its success is becoming rarer and rarer, the producers on the panel acknowledged.

“There’s so many homogenous movies that are coming out of studios,” said Kevin Walsh, a producer on “Manchester by the Sea.”

Indeed, studios are making superhero movies, not dramas. That reflects a troubling business reality — fewer people are going to see indie movies.

Even when studios do back more adult-oriented productions, they tend to insist on happy endings. “Manchester by the Sea” doesn’t offer that kind of closure. Damon noted that Lonergan put it best at Sundance when he was asked why he didn’t end the film on a more optimistic now.

“Kenny said, ‘some people have these things happen to them and they can’t get over it and I think those people deserve a movie too,'” Damon remembered.

That kind of refusal to tie up all the loose ends is more like life, the team behind “Manchester by the Sea” argued.

“Movies are just a powerful tool for empathy… that’s why I think we all make them,” said Damon.