The accounting firm responsible for the counting and collation of votes for the Oscars has apologised for its part in the blunder that saw La La Land announced as the winner of best picture instead of Moonlight.

The mix-up saw the musical announced as the victor due to duplicate sets of cards, held by the only two people who knew the results, being mistakenly handed out to presenters Warren Beatty and Faye Dunaway.

A statement from accountancy firm PricewaterhouseCoopers (PWC) said: “We sincerely apologise 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. We appreciate the grace with which the nominees, the Academy, ABC, and Jimmy Kimmel handled the situation.”

pic.twitter.com/oGJkXytnQ2

– PwC LLP (@PwC_LLP) February 27, 2017 Bonnie and Clyde stars Beatty and Dunaway announced La La Land had taken the best picture prize until the film’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.”

Spotted backstage at the #Oscars: @briancullinan_ and @MarthaLTRuiz keep Watch the big short online free over the envelopes pic.twitter.com/FpYxR9oM9K

– PwC LLP (@PwC_LLP) February 27, 2017 The film’s director Barry Jenkins said: “Very clearly even in my dreams this cant be true. But to hell with it because this is true. It’s true, it’s not fake.”

STILL SPEECHLESS pic.twitter.com/qe3NUDWAHM

– Barry Jenkins (@BarryJenkins) February 27, 2017 Nothing like live TV. Congrats to Moonlight! And to La La Land for such a gracious reaction. #Oscars

– Ellen DeGeneres (@TheEllenShow) February 27, 2017 Warren Beatty seems to be opening an envelope that says ‘Actress in a Leading Role’. He must have been handed the wrong one somehow. Yikes. pic.twitter.com/Rma4wp80aX

– Neil Patrick Harris (@ActuallyNPH) February 27, 2017 Paying tribute to the team behind La La Land, he said: “We have been on the road with these guys and it was so gracious and so generous of them.”

Whaaaaaaa??!congratulations Moonlight! My favorite #Oscars in memory!!

– Oprah Winfrey (@Oprah) February 27, 2017 MOONLIGHT!!!! love is love is love is love is love is love is love is love is love is love is love is love is love #BestPicture #Oscars

– Jessica Chastain (@jes_chastain) February 27, 2017 I’m mean … I just … that’s the craziest thing I’ve ever been witness to. Huge congrats to Moonlight, which is fantastic. Wow.

– Paul Feig (@paulfeig) February 27, 2017 Congratulations to the Moonlight team. It truly is a beautiful film. Well done

– John Legend (@johnlegend) February 27, 2017 I wrote the ending of the academy awards 2017. @jimmykimmel we really got them!

– M. Night Shyamalan (@MNightShyamalan) February 27, 2017 Producer Dede Gardner added: “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 his beautiful group of artists.”

The ceremony kicked off with host Jimmy Kimmel thanking President Donald Trump for making the Oscars appear less racist.

The talk show host said he knew the country was divided and he had been encouraged to say something that would unite people.

My opening monologue from the 89th #Oscars… @TheAcademy @ABCNetwork pic.twitter.com/rXNU8aZfcd

– Jimmy Kimmel (@jimmykimmel) February 27, 2017 He said the ceremony was being watched around the world by “countries that now hate us” adding: “The country is divided right now, I’ve been been getting advice that I need to say something to unite us. Let me say something. I can’t do that. There is only one Braveheart in this room and he’s not going to do that either.”

He added: “I want to say thank you to President Trump. Remember last year when it seemed like the Oscars were racist? It’s gone!” Referring to nominated films Hidden Figures and La La Land, he added: “Black people saved Nasa and white people saved jazz, that’s what you call progress.”

Hey @realDonaldTrump u up?

– Jimmy Kimmel (@jimmykimmel) February 27, 2017 During a break in awards, Kimmel said he was worried about President Trump because he had not yet tweeted anything about the ceremony.

The Salesman, directed by Iranian film-maker Asghar Farhadi, who is boycotting the ceremony because of Donald Trump’s travel ban, won the foreign language film Oscar.

Iranian film director Asghar Farhadi explains why he is not at the #Oscars to collect his award for best foreign film pic.twitter.com/6MB7IBd4qh

– PA Showbiz (@PAshowbiz) February 27, 2017 In a statement read on his behalf, Farhadi, whose film A Separation won the same prize in 2012, said it was a “great honour” to receive the prize for a second time. He added: “I’m sorry I’m not with you tonight, my absence is out of respect for the people of my country and the other six nations who have been banned. Dividing the world into the us and the enemy categories creates fear, justification for war.”

Gael Garcia Bernal and Hailee Steinfeld presented the award for best animated feature film to Disney’s Zootopia, which was released in the UK as Zootropolis. Before announcing the winner, the Mexican actor said: “As a Mexican, as a Latin American, as a migrant worker, as a human being, I’m against any form of wall that wants to separate us.”