Perched atop a stage resembling a desolate mountain hideaway fit for a villain, 21 Savage conjured the image of a menacing overlord several times during his show at the Anthem on Tuesday night. The animated carnage projected on the screen behind him throughout the show reinforced the effect: Thunder striking the ground in graveyards. Piles of bodies falling into a raging pit of fire. Skulls everywhere.

The cartoonish, horror-flick imagery complemented 21 Savage’s chilling street tales, but it couldn’t match the all-too-real threat the Atlanta-based rapper faced in February, just hours before the Super Bowl, when he was arrested in his hometown by U.S. Immigration and Customs Enforcement agents.

The agency claimed 21 Savage was an “unlawfully present United Kingdom national” who had overstayed his visa. The arrest came just days after 21 Savage performed “A Lot” from his chart-topping 2018 album “I Am > I Was” on “The Tonight Show Starring Jimmy Fallon” (he had added a verse mentioning children being separated from their parents at the U.S.-Mexico border). He faced the possibility of deportation.

Although 21 Savage was released 10 days later, his circumstances highlighted the fraught circumstances that both black people and immigrants face in America. Forget the fame — the rapper born She’yaa Bin Abraham-Joseph is still a civilian, vulnerable to what appeared to be targeting by law enforcement.

Nevertheless, 21 Savage’s performance on Tuesday night reinforced his long-held position: No matter the test, he’ll emerge triumphant.

The first portion of 21 Savage’s set found the rapper mostly tearing through many of his collaborations — some bleak, some spirited. He delighted in exploring “Savage Mode,” his 2016 EP with producer Metro Boomin, performing “No Advance,” a prime example of 21 Savage at his most playfully morose. With the bass reverberating through the venue, he growled lines such as “I walk off in the room, I be feelin’ the tension” with pleasure. Over the downtempo drag of “No Heart,” he explains how he’s been remorseless since childhood. However, performing his verses from Cardi B’s “Bartier Cardi” and Post Malone’s “Rockstar” offered a little more candor, lightening the mood without 21 Savage shedding his no-nonsense ethos.

Footage showing 21 Savage’s attorney and the Rev. Al Sharpton speaking about his arrest, crowds cheering his release from ICE custody and a subsequent interview with NBC News was supposed to mark the official segue into the latter portion of the show. However, the true shift in tone arrived with the sound of East of Underground’s “I Love You.” That’s the song sampled on “A Lot,” the track 21 Savage played on Fallon’s show just before his February arrest.

“A Lot” stood out as the most comprehensive look at the rapper’s journey. “I been through the storm and it turned me to a G / But the other side was sunny, I get paid to rap on beats,” he rapped on the second verse.

21 Savage’s upbringing may have hardened him, but at Tuesday’s show he made it clear that life’s constant tests have made him stronger and wiser. He’s more appreciative of all he’s accomplished. He knows it can all vanish in an instant, and he’s a better version of himself as a result.