During “Fuck Your Ethnicity,” the very first song on Kendrick Lamar’s very first album, a robotic voice beamed in with this: “Reporting live from Planet Terminator X, I am Martin Luther King with an AK-47.”

That moment feels prescient after the release of Black Panther, the Marvel superhero story soundtracked by Lamar. There’s the line’s sci-fi, futuristic concept. There’s the nod to black nationalism and hip-hop history with the mention of Public Enemy’s Terminator X. And there’s the twinning of symbols of violence with nonviolence, suggesting that even a champion of compassion might still sometimes have to pick up a weapon.

Ryan Coogler’s absorbing Black Panther uses the hidden high-tech African utopia of Wakanda as the setting to explore a question well familiar in the arc of history. What should people routinely exploited by racist systems do? Individually pursue their own success? Band together and fight back? Or find a third way? As my colleague Vann Newkirk writes, Black Panther fits into a long lineage as “a fantasy about black power”—and about how best to use that power.

Midway through the production process, Coogler screened some of his footage for Lamar, the Compton rapper whose blend of brainy, socially engaged introspection and forward-thinking sonic vision has made him one of the decade’s most important musical figures. What he saw so thrilled Lamar that he went beyond his initial assignment of one or two original songs and ended up co-producing a full soundtrack with his label boss Anthony “Top Dawg” Tiffith. You can understand why he pounced. Coogler’s movie, which has earned the fifth biggest box-office opening of all time, not only rewrites Hollywood’s norms around racial representation. It’s also a day-glo, big-budget, action-packed depiction of the same conflicts that animate Lamar’s career.

Lamar and Top Dawg Entertainment’s final product, the No. 1–selling Black Panther: The Album, doesn’t constrain itself with too many literal shout-outs to the movie. But with its polyglot swirl of sounds and voices—soft and hard, fast and slow, American and African—it mimics the film’s aesthetics. More deeply, it plays with the film’s ideas, and subtly points to how hip-hop as a whole has always played with those ideas.

The super-powered Black Panther, King T’Challa, rules a people who have evaded the damage of white colonialism and hoarded the wealth under their feet. Wakanda itself—colorful, rich, and lavishly ritualistic—seems to swagger on camera. Hip-hop’s proud, materialist tradition exists for related reasons: getting one’s own, in spite of everything that would stop you. “All my life I want money and power” goes the teen dream of “Backseat Freestyle,” one of many examples of Lamar—temporarily, self-critically—indulging the rush of winning. You can hear similar stunting early on Black Panther: The Album with “X,” both in the twitchy, defiant chorus (“I wore the crown all day”) and in the Soweto artist Saudi rapping in Zulu about stacking Benjamins on Madibas.

As played by Chadwick Boseman, King T’Challa does not swagger, though. He reads as serious and self-reflective, more burdened by his responsibility than enlivened by his power—an apt description of how Lamar often seems in the public eye, too. T’Challa’s ex-flame, the spy Nakia (Lupita Nyong’o), advocates that Wakanda use its resources to nourish those in need around the globe. His friend, the tribal leader W’Kabi (Daniel Kaluuya), wants to intervene in more warlike ways. And T’Challa insists that maintaining the miracle of Wakanda means remaining apart from the world.

Watching T’Challa knot his brows over this debate in the early part of the movie, you might think of Lamar’s “untitled 02 | 06.23.2014.,” in which the rapper tours a landscape of black poverty and frets, “I just got a raise / Spent it all on me.” Or you might think of “u,” a lacerating guilt trip about Lamar leaving behind Compton on the way to stardom. The opening of Black Panther: The Album has him rapping as T’Challa, and it’s the most obviously Kendrick Lamar–ian thing on the soundtrack: a nervous, sparse litany about being torn apart by competing forces, with a swarm of voices dissonantly asking, “What do you stand for? Are you an activist? … Are you an accident? Are you just in the way?”

Those voices of criticism gain furious form in Black Panther via its spellbinding villain Killmonger, a lost scion of Wakanda, raised amid American inequality and made deadly by the American military. He seeks—mild spoiler—to use Wakanda’s resources in the brutal conquest of oppressors of the African diaspora worldwide. Played magnetically by Michael B. Jordan with deftly empathetic writing by Coogler and Joe Robert Cole, Killmonger is a rare bad guy with a good point. If his violence and spite read as evil, he’s still advocating for the privileged few to help the unlucky many.

Resentment and rage from the same well as Killmonger’s sometimes surges through—and becomes the subject of—Lamar’s music, to thrilling effect. There’s a hint of Killmonger in the verses of Lamar’s “Blacker the Berry,” a brilliant rant against white mistreatment (which, this being the ever-self-interrogating Lamar, ends up indicting the ranter). Same goes for the middle third of “XXX,” the revenge fantasy that Lamar recently made into a fiery spectacle at the Grammys. The Killmongerian ethos also echoes in the outro of Lamar’s album To Pimp a Butterfly, in which we hear Tupac predict, “next time it’s a riot there’s gonna be bloodshed for real … it’s gonna be like Nat Turner, 1831, up in this muthafucka.”

Killmonger, too, drives many of the most spectacular parts of Black Panther: The Album. As a West Coast city kid (like Lamar himself), the character feels like the inspiration for the album’s more aggressive, streetwise flexes: the pulsing, sirens-streaked clamor of the Bay Area group SOB x RBE on “Paramedic!” or Ab-Soul’s fastidiously crafted kill-or-be-killed explainer on “Bloody Waters.” The tense, bumping lead single “King’s Dead” tips its hand as Killmonger-affiliated even before Lamar erupts in the song’s final moments with a list of fuck yous. “I’ll be blacking out with the purists,” goes one of the chorus’s taunts to some soft, compromising rival.

This being a Disney movie, no one should be surprised that the murderous revolutionary doesn’t get everything he wants. But neither is the closing vision a total endorsement of T’Challa’s original caution. It’s a synthesis, a third way, one that celebrates joining a common cause even if it invites risk. Nonviolence isn’t really part of the discussion: The Wakandans, we vividly see, have a rich warrior culture, ready to defend against the challenges sure to come.

On the soundtrack, resolution comes in the aptly named “Redemption,” a blissful workout of South African gqom house beats, the airy trill of Los Angeles pop newcomer Zacari, and affirmations in Zulu from South African singer Babes Wodumo. “Two wrongs don't make us right away,” Lamar says in the intro. There’s also the wistful “Seasons,” on which the soulful Johannesburg crooner Sjava banishes “poverty, jealousy, negativity” while the Sacramento emcee Mozzy wearily notes, “They tryna tell us that we all equal / We get no justice so it ain't peaceful, yeah.” Lamar closes the song with a benediction: “I am T'Challa / I am Killmonger / One world, one God, one family / Celebration.” The album’s two splashy pop singles,  “Pray for Me” and “All the Stars,” also feel thematically all-encompassing—bighearted, triumphant, but still ready to scrap (both songs are less catchy than Khalid and Swae Lee’s sweetly romantic “The Ways”).

Lamar’s broader catalogue contains few such happy endings, but at the core he preaches mindfulness, solidarity, and spiritual righteousness as the path to progress. The Black Panther musical project, on which he features in every song but credits himself as a primary performer on only five tracks, may even be him practicing the film’s message about spreading one’s wealth around the diaspora. Killmonger-like anger and T’Challa-like prudence thread through all his songs, but song itself, in Lamar’s view, may be the superpower that eases injustice. In that To Pimp a Butterfly outro during which Tupac predicts a new, bloody Nat Turner–like rebellion, Lamar replies, “In my opinion, only hope that we kinda have left is music and vibrations”—which is, perhaps, the closest thing he has to Vibranium.