Coming-of-age tale Moonlight may have won the Oscar for Best Picture on Hollywood's biggest night, but the win was overshadowed by an embarrassing onstage gaffe that instead saw La La Land mistakenly announced as the winner of the top award.

In a mishap that caused uproar and confusion, presenters Warren Beatty and Faye Dunaway initially announced that romantic musical La La Land, the presumed favourite for best picture, had won.

As the casts of both films stood awkwardly on stage, Beatty explained he had been given the wrong envelope to open.

The moment it all went so wrong

It was the first time in living memory that such a major mistake had been made at the Academy Awards.

La La Land's producer Fred Berger said: "This is not a joke. Moonlight is Best Picture," and showed the camera the card that revealed the winner.

Beatty returned to the microphone to say: "I want to tell you what happened. I opened the envelope and it said 'Emma Stone, La La Land' and that is why I took such a long look at Faye and at you.

"I wasn't trying to be funny. This is Moonlight for Best Picture."

The Academy even tweeted out the wrong Best Picture winner, but quickly deleted the tweet

Several hours after the ceremony, The Academy issued an apology over the major gaffe from PricewaterhouseCooper, the accountancy firm responsible for counting the ballots.

It said that the presenters "had mistakenly been given the wrong category envelope and when discovered, was immediately corrected. We are currently investigating how this could have happened, and deeply regret that this occurred".

Massive Oscars Best Picture gaffe - how did it happen?

The statement also apologised to the presenters and the movies for the colossal mix up.

We sincerely apologize to Moonlight, La La Land, Warren Beatty, Faye Dunaway, and Oscar viewers for the error that was made during the award announcement for Best Picture.

Backstage after the ceremony, Moonlight star and Best Supporting Actor winner Mahershala Ali said the confusion over the Best Picture winner made it hard to feel any "joy" in the moment.

Mahershala Ali says it was "hard to feel joy in a moment like that"

"When I did see security people coming onstage and their moment was being disrupted in some way, I got really worried and then when they said, ‘Moonlight, you guys have won,’ it just threw me, more than a bit.

I didn’t want to go up there and take anything from somebody. It’s very hard to feel joy in a moment like that. I feel very fortunate for all of us to have walked away with the best picture award. It’s pretty remarkable.

Click here for other Oscar gaffes and shockers

Moonlight and La La Land - The story of the 89th Oscars

After a brilliant, politically-charged debut as presenter from Jimmy Kimmel, his work and all the other winners were relegated to the cheap seats as the epic envelope mistake became the most infamous moment in Academy Awards history.


           
"Is that the craziest Oscar moment of all time?" Emma Stone, who won the best actress Oscar for her La La Land role as a struggling actress, told reporters backstage. "It's a very strange happening for Oscar history."

On the night, La La Land's six Oscars also included Best Director for Damien Chazelle, Best Score and Best Song - but that 'six of the best' had become a footnote before the show had ended.

Nonetheless Chazelle did make history by becoming the youngest Best Director winner at the Academy Awards at the age of 32.

Damien Chazelle accepting his Best Director Award

Casey Affleck won Best Actor for Manchester by the Sea, the bereavement drama's second win on the night after Best Original Screenplay for writer-director Kenneth Lonergan. Affleck and his brother Ben are now the only brothers to have both won Academy Awards.

"Man, I wish I had something better and more meaningful to say...I'm just dumbfounded that I'm included," said Affleck, who plays a heart-broken father in the movie.

Manchester by the Sea's Casey Affleck accepts his Best Actor Oscar from Brie Larson

As expected, Viola Davis was named Best Supporting Actress for Fences with another favourite, Moonlight's Mahershala Ali named Best Supporting Actor - the first Muslim actor to win an Oscar

Davis gave the most emotional speech of the night. "There is one place that only people with the great potential are gathered and that is the graveyard," she said.

Fences star Viola Davis savours her Best Supporting Actress win

Along with Ali's win and Moonlight's Best Picture victory, the film also took the Best Adapted Screenplay award.

Moonlight producer Adele Romanski said she hoped the movie would inspire "little black boys and brown girls and other folks watching at home who feel marginalised."

Click here for the full list of winners.

Away from the La La Land/Moonlight eclipse, the longest drought in Oscars history came to an end when Hacksaw Ridge sound mixer Kevin O'Connell finally won an Oscar - it was his 21st nomination.

The wait is finally over for Kevin O'Connell!

Speaking backstage after his very long-awaited victory, O'Connell said: "I can't even tell you the experience it was for me. As much as I thought I knew what it would feel like [to win an Academy Award] I didn't. It was the greatest feeling in my entire life."

Irish hopes on the night had been pinned on Ruth Negga - a Best Actress nominee for Loving, Florence Foster Jenkins costume designer Consolata Boyle and the black comedy The Lobster.

However, there were no Irish wins on the most shocking night in Oscars history. 

Ruth Negga was one of those wearing a blue ribbon in support of the ACLU

Best Actress nominee Negga cut a fine dash on the red carpet and spoke about the Oscar experience.

"I don't see it as being up against anybody," she insisted. "I see it as a celebration of extraordinary performances by women who have integrity and talent that is extraordinary and that we want to lean into.

Earlier in the show, President Trump had been the butt of numerous jokes, capping an awards season marked by fiery protests by celebrities at his policies. 

Host Jimmy Kimmel took aim at President Trump

Oscars host Jimmy Kimmel fired-off political zingers and even tweeted at the Republican president, getting no immediate response.

Several celebrities, including Ruth Negga, wore blue ribbons in support of the American Civil Liberties Union (ACLU) advocacy group that worked to get Trump's bid to ban travellers from seven majority Muslim nations blocked in US courts.

But for the most part, speeches at the ceremony were mild or made general pleas for tolerance rather than directly attacking Mr Trump.
           
Iranian director Asghar Farhadi was an exception. His drama The Salesman was named best foreign language film but Farhadi, boycotted the ceremony because of the Trump travel ban.           

More coverage on rte.ie/entertainment/oscars

To watch the jaw-drop of jaw-drops, and the rest of the show, tune in to RTÉ2 tonight at 9.30pm.