Clint Eastwood occupies the same position in pop culture that Keith Richards does: he has been around for ever; he has done tons of amazing work; he embodies the rebellious, iconoclastic spirit of the mid-60s; and he has never sold out and become a joke like just about everyone else in his generation.

Even timid, self-effacing men who have never fired a gun, much less puffed on a stogie, secretly wish that they could just once sport that filthy poncho, bite down on that cigarillo and fill the streets of Laredo with lead. When push comes to shove, Eastwood, the original rock-star cowboy, can always fall back on the statement: “I’m Clint Eastwood, and you’re not.”

So there.

A newly released box set, Clint Eastwood: 40 Film Collection, provides a perfect opportunity to assess the star’s remarkable career both as an actor and as a director.

Eastwood, with whom the public has had a love affair for the 59 years since he debuted as high chaparral stud muffin Rowdy Yates in the TV series Rawhide, has probably had the most amazing career in motion picture history. There are bigger stars and there are better directors, and there are other stars who have become accomplished film-makers, but none of them can touch Eastwood for the breadth and quality of his work, for his success at the box office, and for his ability to never go out of fashion.

Eastwood has starred in or directed roughly one movie a year for the past 53 years. Most of them have been pretty good; some have been great. (Some of the greats don’t actually make this box set, including A Fistful of Dollars, For a Few Dollars More or The Good, the Bad and the Ugly, the films that made him famous).

The equally prolific Woody Allen comes closest to Eastwood as a creative double threat, but Allen makes the same movie over and over again, and he cannot act in any way, shape or form. And, unlike Woody Allen, the public actually likes Clint Eastwood.

The Man With No Name: Eastwood’s most famous character is absent from the box set. Photograph: PEA/Kobal/Rex/Shutterstock

Though Eastwood is probably best known as the Man With No Name – the mysterious loner with the poncho and the cigarillo – he did not make all that many westerns, and none since Unforgiven in 1992. Unlike John Wayne, Randolph Scott and all the other great cowboys of yore, Eastwood has never made a bad western. Indeed, it was Eastwood, bringing to life Leone’s vision, who deposed Wayne and the other just-add-water cowpokes, by introducing an entirely new kind of hero. The Man With No Name materialised out of nowhere, with an uncertain pedigree and undefined motivation. He embodied the ethos of the 1960s: I just want to be left alone to do my own thing, even if it means killing off half the population of Arizona.

At a very early point in his career, Eastwood decided he was going to make his own films, blasting off with Play Misty for Me. It would introduce several of Eastwood’s trademark themes – men are spectacularly shallow and mostly want women for sex; cops are idiots; when in doubt, take the law into your own hands. From here on, the classic Eastwood action film, whether it was Dirty Harry or Pale Rider or Sudden Impact or Unforgiven would be animated by a simple principle: there are bad people out there and eventually I’m going to kill them. Just don’t rush me.

Eastwood was excoriated early in his career for the law-and-order Dirty Harry movies, which lionised a rogue cop fed up with bleeding-heart liberals, turn-’em-loose judges and girly-men politicians. The premise of the five films that comprise the Dirty Harry series was that stupid or corrupt bureaucrats were making it impossible for honest, hard-working policemen to do their jobs. But, for those who might accuse Eastwood of being a generic rightwing neanderthal, this is also the premise of The Wire.

Dirty Harry’s values are the values of the angry white men who elected Richard Nixon in 1969, and they are the values of the angry white men who elected Donald Trump 47 years later. Unlike them, Dirty Harry had to change with the times, reluctantly coming to terms with feminism and minorities as the series progressed. Indeed, the racist, xenophobic, gun-toting old white guy in Gran Torino is basically Dirty Harry in winter. But eventually even that film’s hero, Walt Kowalski, has a change of heart toward his immigrant neighbours. This is something Trump’s real-life supporters would never do.

When Clyde met Clint: 1978’s Every Which Way But Loose. Photograph: Associated Press

Eastwood has made violent films, arty films, heartwarming films and a handful of dimwit comedies. He has made films that are thrilling from the opening credits (Pale Rider, Gran Torino, Mystic River, Unforgiven, The Outlaw Josey Wales) and films that are dead on arrival (Jersey Boys, Midnight in the Garden of Good and Evil). He has made films that are weird (The Beguiled, High Plains Drifter, Changeling), films that are creepy (The Gauntlet, Play Misty for Me, J Edgar), films that are politically incorrect (Dirty Harry, Tightrope, Gran Torino) and even a few films that are charming (The Bridges of Madison County, A Perfect Life, Invictus, Hereafter). He has made a couple of movies that are just plain stupid (the bookend movies Every Which Way But Loose and Any Which Way You Can, co-starring an orangutan, and the inane Kelly’s Heroes), but he hasn’t made a stupid movie in a long, long time. He has taken good books (Midnight in the Garden of Good and Evil, Flags of Our Fathers) and turned them into not-so-good movies, and he has taken treacly, idiotic books (The Bridges of Madison County) and turned them into something wonderful.

Part of his secret is this: Eastwood never stops working; he is always on to the next project. When a movie flops, he climbs back up into the saddle and makes another one. The hit Space Cowboys follows the dud True Crime. After the public ignores White Hunter, Black Heart, Eastwood comes back with the Oscar-wining Unforgiven. In Eastwood’s world, things are simple. Sometimes, the magic works. Sometimes, it doesn’t.

Eastwood is one of the few directors who got better as he entered his twilight years (he is now 87). In fact, he got a lot better. Most directors are playing out the string by the time they come to the end of the line, but this is not the case for him. Gran Torino, from 2008, was timely and oddly moving; last year’s Sully was a miracle of economical film-making; 2003’s Mystic River was dark and gripping; American Sniper, from 2015, was harsh and disturbing; and 2009’s Invictus was inspiring. Hereafter – his 2011 film about psychics in love – was a surprise that came out of nowhere.

There are certain dominant themes that occur again and again in Eastwood’s movies. Bureaucrats are stupid. Attorneys are scum. Journalists, with few exceptions, are parasites. The law will not save you from evil-doers. Women need protection, even the ones who go around shooting men in the genitals. Nobody likes getting old. Women get mistreated in Eastwood movies. They get punched in the face in Play Misty for Me, they get punched in the face in The Gauntlet, and they get punched in the face in Million Dollar Baby. In fairness to Eastwood, an awful lot of men get punched in the face, too – most especially him.

Shirley MacLaine’s Sister Sara socks it to Eastwood in 1970’s Two Mules for Sister Sara. Photograph: Alamy Stock Photo

Eastwood seems to have decided fairly early in his career that the public liked to see him get battered, because he gets worked over good and proper in the spaghetti westerns, lynched in Hang ’Em High, kicked into a near coma in Unforgiven, and shot dead in Gran Torino. He also gets his leg chopped off in The Beguiled (the original 1971 film, not the remake by Sofia Coppola). This is the only one of his films where Eastwood seems to have made a concerted effort to actually and honestly emote on screen. He wasn’t good at it. He was just too stiff. After The Beguiled, Eastwood mostly danced with the one that brung him – scowling, frowning, doing that thing with the eye. A man has got to know his limitations.

It has been one of his strengths that Eastwood has always been able to bring films in on time and under budget. It helps that he never spent much money on lighting, and that, for most of his career, he used has-beens and nobodies to fill out the cast. He has always seemed willing to give hardworking professionals such as Dan Hedaya and John Russell a payday. Here he has followed in the steps of his mentor Don Siegel: if I have got Clint Eastwood cast in the lead role, anybody can play the sadistic drug dealers, the exasperated district attorney or the long-suffering wife. Only in Eastwood’s most recent work do stars such as Meryl Streep and Matt Damon consistently appear. This is partly because he no longer casts himself as the leading man. Now he has to bring in outside help.

Boxing clever: Eastwood starring with Hilary Swank in Million Dollar Baby (2004). Photograph: Sportsphoto Ltd./Allstar

Eastwood’s themes are archetypal, and he constantly pays homage to those who developed these archetypes. The notion that only an enigmatic gunslinger can deliver the innocent from evil doesn’t originate with Pale Rider; it comes from Shane, arguably the greatest western of them all. The Outlaw Josey Wales is a retelling of Gregory Peck’s The Bravados, with slightly more blood. And Unforgiven looks back to the unconventional Italian westerns that launched his career: the Old Man With No Name.

Movie-making is not so much a process of making new films as of remaking old ones. Trouble With the Curve is the same basic story as Space Cowboys: being old isn’t the same as being dead. J Edgar evokes Citizen Kane: absolute power corrupts absolutely. Stories work today because they worked yesterday. People never get tired of seeing good triumph over evil, because the only place they ever get to see this happen is in the cinema.

In the early 80s, Eastwood seemed to be heading into the creative abyss. Then he pulled himself together and made Pale Rider, which from the thundering hoof beats that open the film announces itself as a classic. This brought to an end the dark, dark Sondra Locke period when he made goofball action films such as Every Which Way But Loose and Any Which Way You Can. These films were his two biggest box office successes at the time. It was, one assumes, the cash generated by these yokel-pleasing hits that gave him the financial freedom to make demanding, arty, deeply personal films such as Bird and White Hunter, Black Heart. The yokels had no interest in those. Not enough orangutans.

Eastwood’s politics are murky; often, he is identified as a libertarian. Libertarians are basically Republicans who can’t quite bring themselves to admit it. Eastwood was widely ridiculed in 2012 when he insulted Barack Obama by speaking to an empty chair at the Republican National Convention. It was embarrassing, and stupid, and Obama didn’t care. After Obama was re-elected, liberals seemed willing to give Eastwood a pass on the empty chair gaffe, in part because it was the sort of thing ornery old coots do, in part because Eastwood was going to bat for the innocuous Mitt Romney, not the sinister Donald Trump, and because, at a very basic level, Americans like Clint Eastwood.

Not your average Republican: Eastwood in Gran Torino. Photograph: Anthony Michael Rivetti/Malposa Productions

There are several Eastwood movies that deal explicitly with politics and in none of them does Eastwood take a uniformly rightwing line. J Edgar, his biopic about FBI chief J Edgar Hoover, who is still a hero to many on the US right, depicts the powerful director as paranoid, duplicitous, closeted, vindictive, hypocritical, cowardly and just plain weird. Absolute Power gives us a White House filled with flag-waving reptiles. Flags of Our Fathers pays tribute to a bunch of courageous youngsters taken for a ride by their own government. Million Dollar Baby was widely perceived as a slap in the face of the Bush administration, in that it embraced euthanasia, which Bush did not. American Sniper, regardless of how it was perceived by the US right, does not in any way suggest that invading Iraq was Dick Cheney’s best idea. Invictus presents Nelson Mandela as a cross between St Francis of Assisi and Pericles. Whatever Eastwood’s politics are in real life, he mostly keeps ideology out of his movies.

What’s more, conservatives reflexively support the police, no matter how many unarmed black people they shoot. But Eastwood’s movies often display a profound disdain for the boys in blue: Gene Hackman’s sadistic sheriff in Unforgiven, John Brown’s icy rent-a-thug in Pale Rider, the stupid small-town police chief in Bronco Billy, the murderous vigilante motorcycle cops in Magnum Force.

Nor does Eastwood like suits. In grumpy-old-men flicks such as Trouble with the Curve and Space Cowboys, the enemy is not bleeding-heart liberals or spineless judges. It’s Yuppie hotshots who value technology over old-fashioned know-how. It’s heartless number crunchers who are more than happy to put old men out to pasture. In Trouble with the Curve, the lawyers are schmucks, the boy-wonder baseball player is a schmuck, and the executives in the front office are schmucks. The guy you root against in the film is a fat, stupid white boy. The guy you root for is a dirt-poor Mexican. You getting all this, Donald?

The Clint Eastwood 40 Film Collection box set is out now on Warner Home Video.