Coming-of-age drama "Moonlight" won the coveted best picture statuette at Sunday's Oscars, but the evening ended in chaos as "La La Land" -- already the winner of six prizes - was first mistakenly handed the award.
Until the final minute, the film industry's biggest night had run smoothly, and was marked by plenty of political statements, mainly jabs at President Donald Trump, and light-hearted jokes from host Jimmy Kimmel.
But the epic stumble on the final award was the nightmare Hollywood ending no one wanted to see.
Tinseltown legends Warren Beatty and Faye Dunaway, stars of 1967 crime classic "Bonnie and Clyde," were meant to give the best picture Oscar to Barry Jenkins's film, but she mistakenly called it for Damien Chazelle's musical.
Scenes of confusion and embarrassment followed after the "La La Land" crew - already on stage and delivering speeches - suddenly realized the mistake and announced themselves that "Moonlight" had actually won, prompting Beatty to mumble apologies.
The Oscar-winning veteran actor and director, 79, said he'd been given the wrong envelope - the one containing the card announcing "La La Land" star Emma Stone's best actress win.
Stone said backstage she had been hanging on to her winning envelope the whole time, although slowed-down footage of the commotion appeared to corroborate Beatty's explanation.
Several reports suggested that two sets of envelopes are typically on site during the ceremony - one on either side of the stage.
"This was confusing, obviously, so... we thought he was being coy and cute and milking it but, in reality, he was perplexed by why her name was on it," host Jimmy Kimmel told ABC after the show.
So far, the Academy of Motion Picture Arts and Sciences has not issued a formal statement about the embarrassing mix-up.
"Moonlight" was a shock winner for best picture, after Chazelle's runaway favorite "La La Land" - a modern take on the all-singing, all-dancing Golden Age of Tinseltown's studio system - had taken six prizes for best director, actress, score, song, production design and cinematography.
"I noticed the commotion and thought something was strange. And then I was speechless by the result," Jenkins, who won earlier for best adapted screenplay, said backstage.
"I've watched the Academy Awards before and have and have never seen that happen before."
Starring Naomie Harris and Mahershala Ali - who bagged the first of the movie's three Oscars - "Moonlight" tells the life story of a young African-American struggling to find his place as he grows up poor in Miami.
The film has won plaudits as a vital portrait of contemporary African-American life and is praised in equal measure as a moving meditation on identity, family, friendship and love.
It beat seven other films besides "La La Land" - including alien thriller "Arrival" and family dramas "Manchester by the Sea" and "Fences" - for best picture honors.
Despite the stunning finish, sure to go down as one of the worst moments in Oscars history, the overall winner of the night was still "La La Land".
Starring Stone and Ryan Gosling as an aspiring actress and a struggling jazz musician who fall in love in Los Angeles, it has charmed critics the world over and returned more than 10 times its $30 million budget.
"This was a movie about love and I was lucky enough to fall in love while making it," said Chazelle, 32, the youngest filmmaker by several months ever to win a best directing Oscar.
Music and politics
The gala began without incident - Justin Timberlake crooned some upbeat music. Kimmel then wasted no time putting the A-list audience in a political frame of mind.
"This broadcast is being watched live by millions of Americans and around the world in more than 225 countries that now hate us," joked the 49-year-old Kimmel.
The late-night comedian quipped that Trump, who pulled off a political upset win with his campaign that targeted immigration, had taken the heat off Hollywood and its annual gala.
"I want to say thank you to President Trump. Remember last year when it seemed like the Oscars were racist? That's gone, thanks to him," Kimmel said.
This year's nominees have reflected a push by the Academy to reward diversity after the #OscarsSoWhite controversy of the past two years that prompted calls for a boycott of the annual bash.
Ali won the best supporting actor prize for his turn as a drug dealer with a heart in "Moonlight" while fellow African-American Viola Davis took the supporting actress statuette for her work in "Fences."
Casey Affleck triumphs
The most intriguing race was for best actor, which for weeks looked like a lock for "Manchester by the Sea" star Casey Affleck, but the 41-year-old had to fend off a late surge by Denzel Washington ("Fences") to take the trophy.
Stone bagged her first statuette in the best actress category despite a late push from Isabelle Huppert, already a Golden Globe winner for edgy rape-revenge thriller "Elle."
"Manchester" went into the evening with six nominations but came away with only Affleck's win and a best original screenplay statuette for Kenneth Lonergan, who also directed the film.
The Oscars is the highlight of the Tinseltown calendar, and wraps up two months of glittering prize galas.
This awards season, the popping of champagne corks has been muted by the tense political situation in the United States.
Trump's controversial (and now halted) travel ban led Iranian director Asghar Farhadi to opt out of attending - but a statement from Farhadi was read when his "The Salesman" was named best foreign language film.
Kimmel made mention of Trump's retort that Streep was "highly overrated" - by recalling her record 20 nominations, and urging everyone to offer her a standing ovation. The audience willingly complied.
Emma Stone wins best actress Oscar for 'La La Land'
Emma Stone won the Oscar for best actress on Sunday for the whimsical musical "La La Land," the most honored film of the night.
The 28-year-old won her first Oscar in a field that included former winners Meryl Streep and Natalie Portman, as well as Ruth Negga for interracial historical drama "Loving" and French actress Isabelle Huppert for rape-revenge thriller "Elle."
Casey Affleck wins best actor Oscar for 'Manchester by the Sea'
Casey Affleck won the Oscar for best actor on Sunday for his searing role as a man marked by tragedy in the family drama "Manchester by the Sea."
Affleck beat out a crowd that included Ryan Gosling of the musical "La La Land" as well as Andrew Garfield for "Hacksaw Ridge," Viggo Mortensen for "Captain Fantastic" and Denzel Washington for "Fences."
'Moonlight' wins best picture Oscar
"Moonlight," a poignant coming-of-age story set in the tough projects of southern Florida, on Sunday won the best picture Oscar - but not before the prize was first given in error to musical "La La Land."
The mistake - only corrected after the producers of "La La Land" had come on stage to accept the award - was a stunning end to the film industry's biggest night.