Hugh Jackman’s Wolverine dresses like a civilian, often against Southwestern backdrops, in “Logan.” (Twentieth Century Fox)

WAS IT just the costumes that were fueling the extreme prejudice all along?

For all its billions of dollars in box-office success, superhero cinema is still — yes, still — commonly derided as would-be kiddie fare unfit for grown-ups. We see it in such media headlines as: “No self-respecting adult should buy comics or watch superhero movies.” (Sample passage: “Can we call time on superhero films? Films which are too dark for kids the comics were originally written for, yet too dumb for any thinking adult.”) Simon Pegg — so recently of Star Trek and Star Wars films — calls comic books and superheroes “infantilizing” and “very childish things” that “adults are watching.” And even genre-happy director David Cronenberg has said that “a superhero movie, by definition, you know, it’s comic book. It’s for kids. It’s adolescent in its core. That has always been its appeal.”

Are superhero films escapist? But of course, every bit as much as a horror film or a sci-fi thriller or a martial-arts movie or a great spaghetti Western. Which brings us to the genre-bending “Logan.”

As the 10th film in the X-Men franchise, “Logan” is now winning the kind of reviews for a major-studio superhero film that we haven’t seen since perhaps pivotal 2008, with “The Dark Knight” and “Iron Man.” (“Logan” scores a 77 on — the same as “Iron Man” and just behind “The Dark Knight’s” 82.) And one reason superhero-eschewing filmgoers seem to be embracing Hugh Jackman’s final Wolverine outing is because “Logan” pays homage to a widely accepted genre — Westerns — as much as it does to such Marvel comic story lines as “Old Man Logan.”

[‘Logan’ is the Wolverine movie Hugh Jackman always deserved]

The new film’s references to “Shane” are overt, from footage of the movie to dialogue quoted as a callback to parts of the plot.

Yet director James Mangold and his co-writers wear many other Western references on their fringed sleeves.

One of the most striking is Clint Eastwood’s ’90s masterpiece “Unforgiven,” in which a former killer turned family man picks up his six-shooters again for one last ride.

“Logan” also quick-draws inspiration from the ’70s Eastwood film “The Outlaw Josey Wales,” in which the title character just can’t seem to abandon the way of the gun in the Old West. And “True Grit,” too, feels like a fellow cinematic traveler, given the presence of a young girl along a perilous trek.

“Logan” even winks to the Mad Max films — apocalyptic Westerns that remind you that a young Mel Gibson might have made a convincingly feral Wolverine.

As such, Mangold is keenly aware that tropes identified with the Western can readily be adapted to any host of action films — from the lone avenging gunman to the morally upright posse to the shoot-’em-up blood feud that erupts over money or land or love.

It also helps Wolverine’s genre-jumping that “X-Men” director Bryan Singer and his team decided nearly two decades ago to trade in the electric-yellow tints of the character’s most common comic-book costumes for the bloody undershirt and jeans he dons on the screen.

[The ultimate ranking of all 10 X-Men films, from the original to ‘Logan’]

Pierce (Boyd Holbrook) is after X-23 and not afraid to go through Wolverine to get her. (Twentieth Century Fox)

The “Logan” filmmakers even tease those who mock comics, particularly when Wolverine tells his mutant daughter that comic books are like “ice cream for bed wetters.”

Such lines emphasize the knowingness of the filmmakers’s mission. By disguising their latest Wolverine movie in the look of another, more widely praised genre — by comparison, four Westerns have won the best picture Oscar in the past three decades, compared with zero nominations (let alone wins) ever for superhero movies — Mangold and his team have not only constructed a Wolverine that can appeal to broad adult tastes. They have also built one beautiful Trojan horse for sneaking past movie prejudice.