CNN  — 

The chemistry between Mahershala Ali and Viggo Mortensen in “Green Book” was apparently enough to help Academy voters forget the controversies that have plagued the film during its quest for Oscars gold.

On Sunday, the film, inspired by the true story of a celebrated pianist’s friendship with his driver, was awarded best picture.

It also won best original screenplay and Ali won best actor in a supporting role.

“The whole story is about love,” Peter Farrelly said during the acceptance speech.

In the 1962-set film, Ali plays musician Dr. Donald Shirley and Mortensen portrays his rough-around-the-edges driver and bodyguard, Tony Vallelonga.

The “green book” refers to the guide that told black motorists of hotels that would accept them, while the film derives its hook from the bond that formed between the men.

The film’s first brush with backlash grew as some critics accused it of advancing the “white savior” conceit – a charge that Farrelly rejected in defending the movie, telling Vanity Fair that the two helped each other.

Some of Shirley’s surviving relatives further fanned the flames of discontent by accusing the filmmakers of exaggerating the pair’s friendship.

Then, in November, Mortensen became the target of ire when, during a post-screening discussion, he used the N-word while trying to draw a contrast between the period in which the film is set and present day. He later apologized.

Despite all of that, the movie proved successful on the award circuit, picking up the Golden Globe for best comedy or musical, among other accolades.

In January, more serious accusations threatened to derail “Green Book’s” quest for Oscar gold.

Farrelly had to apologize after news articles referencing past instances of sexual misconduct, veiled at the time as attempts at humor, resurfaced.

“True. I was an idiot,” Farrelly said in a statement to CNN. “I did this decades ago and I thought I was being funny and the truth is I’m embarrassed and it makes me cringe now. I’m deeply sorry.”

The Cut was the first to bring attention to two entertainment news articles, both from 1998, that referenced instances in which Farrelly showed unsuspecting people his penis, including actress Cameron Diaz before she starred in “There’s Something About Mary,” which was directed by Peter Farrelly and his brother Bobby Farrelly.

CNN found an additional reference to this behavior in a 1998 article in The Sunday Times by author Ivan Waterman.

Around the same time, an old tweet by “Green Book” writer Nick Vallelonga that contained an Islamophobic statement came to light, leading him to issue his own apology. Nick Vallelonga is the son of Tony Vallelonga.

In the tweet, sent to then-candidate Donald Trump, Nick Vallelonga claimed he saw “Muslims in Jersey City cheering” when the World Trade Center towers collapsed in the 9/11 terrorist attacks.

“I want to apologize. I spent my life trying to bring this story of overcoming differences and finding common ground to the screen, and I am incredibly sorry to everyone associated with ‘Green Book,’” Vallelonga said in a statement via a representative. “I especially deeply apologize to the brilliant and kind Mahershala Ali, and all members of the Muslim faith, for the hurt I have caused.”

Ali, who won multiple individual honors for his role in the movie, is Muslim.

Vallelonga’s Twitter account was later deleted.

“Green Book” bested box office behemoth “Black Panther,” Netflix contender “Roma,” and the buzzy “A Star Is Born” for the top Oscars prize, among others.

CNN’s Brian Lowry contributed to this report.