(BBC) Moonlight has won best picture at the Oscars – but only after an error saw La La Land initially declared the winner.
The La La Land producers were in the middle of their acceptance speeches when the mistake was discovered.
PriceWaterhouseCooper, the accountancy firm responsible for counting the ballots, apologised for the mix-up.
La La Land still ended up the biggest winner of the night, taking home six Oscars including a best actress award for Emma Stone.
Moonlight’s surprise best picture win took its haul to three, the low-budget film having earlier won the adapted screenplay award and a best supporting actor prize for Mahershala Ali.
Casey Affleck was named best actor for Manchester by the Sea, while Viola Davis was named best supporting actress for Fences.
Damien Chazelle, La La Land’s 32-year-old director, became the youngest film-maker to win the best director Oscar.
Yet this year’s ceremony will be remembered for its closing moments, when Warren Beatty and Faye Dunaway arrived on stage to announced the best picture winner.
Beatty had been mistakenly handed the previous winner’s envelope, containing a card that said Emma Stone had won best actress for La La Land.
It was this card that Dunaway read from, mistakenly declaring La La Land to be best picture and creating what Stone later described as “the craziest Oscar moment of all time”.
In a statement, PriceWaterhouseCooper “sincerely” apologised for the error, which it said was down to the presenters having “mistakenly been given the wrong category envelope”.
“We are currently investigating how this could have happened, and deeply regret that this occurred.”
Host Jimmy Kimmel said he blamed Steve Harvey for the error – a reference to Harvey’s mistake in announcing the Miss Universe winner in 2015.
It was La La Land producer Jordan Horowitz who announced there had been a mistake.
“This is not a joke,” he told the audience, showing the correct card. “Moonlight is best picture.”
Beatty returned to the microphone to explain he had been given an envelope with Emma Stone’s name inside.
“That is why I took such a long look at Faye,” the veteran actor continued. “I wasn’t trying to be funny.”
“Very clearly even in my dreams this can’t be true,” said Moonlight director Barry Jenkins. “But to hell with it because this is true. It’s true, it’s not fake.”
Paying tribute to the team behind La La Land for the way they handled the mistake, he said: “We have been on the road with these guys and it was so gracious and so generous of them.”
Speaking backstage, Emma Stone said it had been “an amazing thing to hear La La Land” named best picture.
“But we are so excited for Moonlight,” she continued. “I think it is one of the best films of all time.
“Is that the craziest Oscar moment of all time? Cool! It’s going to be history.”
La La Land’s other Oscars came for its cinematography, score and production design.
The Hollywood musical romance also won the best original song award for City of Stars, beating another song from its soundtrack in the process.
Kenneth Lonergan received the best original screenplay prize for Manchester by the Sea, which he also directed.
There were two awards too for Mel Gibson’s war film Hacksaw Ridge, which was recognised for its editing and its sound mixing.