There was confusion and controversy at the Oscars as Moonlight won the best picture prize after La La Land was mistakenly announced as the winner.

The producers of the musical were already concluding their speeches when it was revealed there had been a mix-up and Moonlight had in fact scored the top prize of the night.

Bonnie and Clyde stars Warren Beatty and Faye Dunaway had announced La La Land had taken the best picture prize and the cast and crew had flooded the stage before producer Jordan Horowitz said: "There's a mistake. Moonlight, you guys won best picture.

"This is no joke. I'm afraid they read the wrong thing. This is not a joke, Moonlight, you won best picture."

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."

Backstage, Stone said she had been holding her winners card in her hand at the time the best picture winner was announced.

The film's director Barry Jenkins said: "Very clearly even in my dreams this can't be true. But to hell with dreams because this is true. It's true, it's not fake."

La La Land, which had scored a record-tying 14 nominations, ended up with just six wins, including best actress for Emma Stone and best director for Damien Chazelle, who is the youngest winner of the prize at 32.

Moonlight, which follows the life of a young black boy dealing with his sexuality, scooped three prizes in total, landing best picture, best adapted screenplay and best supporting actor for Mahershala Ali.

The film's producer Dede Gardner said: "I'm still not sure this is real. It's very humbling to be up here and I hope it's inspiring to little black boys and brown girls who feel marginalised. I hope they take some inspiration from seeing this beautiful group of artists."

Host Jimmy Kimmel joked that he knew he would mess up compering the ceremony.

He added: "Personally I blame Steve Harvey for this," referring to Harvey's mistake in announcing the Miss Universe winner in 2015.

Stone, 28, who has already received a Golden Globe and Bafta for her role in the hit musical thanked Chazelle and Ryan Gosling, saying of her co-star: "Thank you for making me laugh and for always raising the bar and for being the best partner in this crazy adventure."

Ali won the first Oscar of the 89th Academy Awards when he scooped the best supporting actor prize.

He welcomed his first child Bari Najma on February 22 and thanked his wife Amatus Sami-Karim saying: "My wife was in her third trimester doing awards seasons, we just had a daughter four days ago. I just want to thank her for being such a soldier through this process."

Viola Davis received a standing ovation and cheers as she won the best supporting actress Oscar for her role in Fences.

Davis, who has been nominated twice before for Doubt and The Help, had been the frontrunner for the prize all through awards season. She paid tribute to her co-star and director Denzel Washington, saying: "Oh captain, my captain, Denzel Washington, thank you for putting two entities in the driving seat, August Wilson and God and they served me well."

Casey Affleck won the best actor in a leading role Oscar for his role in Manchester By The Sea, beating fellow actors Ryan Gosling, Denzel Washington, Andrew Garfield and Viggo Mortensen.

Affleck, 41, was hugged and kissed by his brother, Batman star Ben Affleck as his name was called and received a standing ovation as he made his way to the stage.

The actor was tearful as he made his acceptance speech, saying: "This means so much to me, thank you. One of the first people who taught me how to act was Denzel Washington and I just met him tonight for the first time."

Affleck ended his speech by thanking his parents for "mostly believing in me" and added: "Ben, I love you, you ain't heavy."