Kevin Smith reveals in his new book that former film producer Harvey Weinstein deliberately pulled "Good Will Hunting" from theaters early in 1997 to prevent Robin Williams from getting more money.

"I remember when 'Good Will Hunting' was leaving theaters and it felt weird because it was like, 'Wait? There's all this Oscar buzz.' So why would you pull it if it was just making money?" the 51-year-old American filmmaker recalls in his book called "Kevin Smith's Secret Stash" as per ScreenRant.

He then explained the reason behind Weinstein's decision and how the ex-producer benefitted from this move.

"And they did it because keeping it in theaters meant that more of the money would go to Robin, whereas the moment it went to video the split wasn't Robin-heavy," Smith said.

Besides Williams, the movie also starred Matt Damon and Ben Affleck. Interestingly, the movie was penned by both the actors, who also wrote the recently released film "The Last Duel."

Smith had a good rapport with Damon and Affleck as they worked together for a movie "Chasing Amy."

In fact, Smith was the one who got Weinstein's attention to the script of "Good Will Hunting." The movie was later distributed by Miramax, an entertainment company co-founded by Weinstein.

According to Smith, Williams and Miramax had a deal that if the movie grossed $100 million at the box office, the "Jumanji" star would get a bigger portion of the profit.

However, to ensure that Williams wouldn't get bigger pay, the producer and the company decided to pull the movie from the theaters. At that time, its box office collection was nearly $90 million.

Williams earned nine Academy Award nominations for the movie, which tells the story of a working-class mathematics genius played by Damon and a psychiatrist portrayed by Williams.

"Kevin Smith's Secret Stash" hit the bookstands last month. The book talks about the filmmaker's journey in the entertainment world and contains special contributions from celebrities including Affleck, Harley Quinn Smith and J. J. Abrams.

On the work front, Smith is currently filming "Clerks III," which is slated for 2022 release.

Kevin Smith
Kevin Smith is set to direct Season 2, episode 17 of “Supergirl.” Pictured: Smith attends the premiere of ‘Rogue One: A Star Wars Story’ at the Pantages Theatre on Dec. 10, 2016 in Hollywood, California. Getty Images/Mike Windle