It was like M. Night Shyamalan directing the Oscars.

Two minutes after Hollywood musical La La Land was named best picture at Sunday's 89th Academy Awards, there was a twist ending: Presenters Faye Dunaway and Warren Beatty had read the wrong name and it was in fact the arthouse darling Moonlight that won the night's big prize.

In the ceremony hosted by Jimmy Kimmel, Moonlight picked up three awards total — including adapted screenplay and supporting actor for Mahershala Ali — but La La Land's tally wasn't too shabby: It won six Oscars, including best director for Damien Chazelle — the youngest person to ever win the honor — and best actress for Emma Stone. Fences star Viola Davis and Casey Affleck of Manchester by the Sea also picked up their first Oscar wins, for supporting actress and best actor respectively.

From the USA TODAY backstage blog by Bryan Alexander:

As the La La Land filmmakers take the stage to accept best picture, the accountant from PriceWaterhouseCoopers jumps up and says, "He (presenter Warren Beatty) took the wrong envelope!" and goes running onstage. Craziness breaks out. No one knows how Beatty got the best actress envelope.

"Oh, my God. Moonlight won, Moonlight won," a stagehand says, her hands on her head.

The Moonlight filmmakers pour backstage, with Jenkins holding the Oscar and muttering, "Oh, my God, oh, my God." Everyone looks befuddled.

"I feel so weird," Ali says. "Now, that was awkward." He runs into Gosling, who is smiling in spite of it all, and they hug.

La La Land's Chazelle keeps his game face. "That was weird," he says.

Security is looking for Beatty, who had both envelopes. There's much confusion, because Oscar staffers carefully check presenters before they walk out, to make sure they have the right envelope in hand.

"What just happened?" Kimmel says, walking back to his dressing room in shock.