It was a different kind of upset at the Oscars on Sunday night, and not just because Warren Beatty and Faye Dunaway gave the Best Picture award to the wrong movie.

The producers of La La Land literally had the Oscar in hand. The producers of Moonlight pried it away. Awards night theater doesn’t get better than that.

More fascinating, though, are the invisible impulses that put Barry Jenkins’ Moonlight, about a poor gay black man’s survival and self-discovery, in front of Damien Chazelle’s musical La La Land, which had 14 nominations, a pocketful of pre-Oscar wins and all the odds-makers on its side.

This didn’t fit the pattern of the notable upsets in recent Oscar history. When Crash upended Brokeback Mountain in 2006, one theory said conservative Academy voters had rejected Brokeback’s gay love story. Another said Lionsgate, which distributed Crash, had prevailed by flooding the market with an eleventh-hour DVD release. Yet another said that Brokeback, an East Coast favorite distributed by the Manhattan-based Focus Features, was beaten by a West Coast surge among Los Angeles-centric Oscar voters who responded to the hometown vibe of Crash. None of that applied here.

Hubris seemed to be a problem for The Aviator, a self-conscious epic that, much like La La Land, piled up awards early on Oscar evening in 2005, only to see Million Dollar Baby take the big prize. Directed by Martin Scorsese, then overdue for an Oscar, The Aviator arrived with a sense of entitlement that ultimately worked against it. But that hardly applies to La La Land — never was an Oscar contender sold with more aw shucks, gee whiz, foot-scuffling humility.

If Shakespeare in Love upset Saving Private Ryan in 1999, it was probably because Spielberg’s Ryan wore out its welcome. The film was released in July and and ran smack into a late-season competitor that charmed viewers who were looking for something fresh.

But this is something new. Best guess: The Moonlight victory reflects a sharp mood swing in Hollywood during the past few weeks. When the voters in the Producers Guild and other awards groups were endorsing La La Land late last year, or very early in this one, escapism — in the guise of a beautifully crafted Hollywood musical — seemed a valid response to the sort of political turmoil and division that was referenced repeatedly in Sunday night’s Oscar show. But the hardening of attitudes in recent weeks made it harder, by far, to vote for something as light as La La Land. To have endorsed a film about personal ambition, at the expense of films about sexual identity, as with Moonlight, or racial struggles, as with Fences or Hidden Figures, might have seemed to be a declaration of irrelevance.

For Academy voters, apparently, a fairly serious awards show deserved an equally serious winner.