Paramount Pictures plans to withdraw its controversial lawsuit against a crowdfunded "Star Trek" fan film, a move that will undoubtedly earn the studio goodwill as it prepares to release "Star Trek Beyond" amid the franchise's 50th-anniversary celebration.

The announcement was made Friday by J.J. Abrams during a fan event on the Paramount lot, where the filmmaker said the litigation is "going away" within the next few weeks.

Paramount and CBS sued Axanar Productions in December to prevent the production of "Star Trek Axanar," a prequel the producers billed as “first fully-professional, independent ‘Star Trek’ film.” Because the rights holders had long tolerated fan-produced works, from webseries to short films, the action proved both surprising and divisive, and created a chilling effect in the fan film community. It also led "Star Trek Beyond" director Justin Lin to take to Twitter in March to side with fans.

It was apparently Lin's stance that helped to sway Paramount.

“A few months back there was a fan film, 'Axonar,' that was getting made and there was this lawsuit that happened between the studio and these fans," Abrams said on Friday, "and Justin, I’ll tell the story because he probably wouldn’t, was sort of outraged by this as a longtime fan. We started talking about it and realized this was not an appropriate way to deal with the fans. The fans should be celebrating this thing. Fans of 'Star Trek' are part of this world. So he went to the studio and pushed them to stop this lawsuit and now, within the next few weeks, it will be announced this is going away, and that fans would be able to continue working on their project.”

Axanar Productions released a response to the unexpected announcement, thanking Abrams and Lin for their support while noting the lawsuit remains pending: "There is still a lot of work to do, but receiving this kind of public support helps immensely."

“Axanar” takes place 21 years before the events of “Where No Man Has Gone Before,” the second pilot of the classic “Star Trek” series, which introduced William Shatner as James T. Kirk. The film is described as the story of legendary Starfleet captain Garth of Izar and his crew during the Four Years War between the Klingon Empire and the Federation.