As with the wars in the Middle East, Afghanistan highlights the difficult political choices and counter-insurgency strategies the US has been pursuing fruitlessly since 9/11. Today six Muslim countries (Iraq, Syria, Yemen, Libya, Somalia and Afghanistan) are in a state of meltdown – partly as a result of US policies that have failed to take into account on-the-ground realities.

The “war on terror” launched by President George Bush, the US invasions of Afghanistan and Iraq, and the conflicting policies of carrying out regime change in the midst of an ever-expanding Islamist extremist opposition have all created greater dilemmas for the US. Since 9/11 there have been many good books and documentary films made about these dilemmas. Yet in all this time Hollywood has been unable to produce a movie that informs or educates the average movie-goer as to the bigger picture on why failure persists and jihadism spreads.

The few Hollywood films made about America’s wars tend to be either satires or action movies in the John Wayne mould, showing US troops as heroic and caring but professional killers. One exception was the 2008 film Hurt Locker, which won six Oscars and depicted the dilemmas faced by a US Explosive Ordinance Disposal unit in Iraq. But even Hurt Locker dealt with only a slice of the problem, as did otherwise well-made documentaries about US forces in Afghanistan such as the 2010 film, Restrepo and Korengal by Sebastian Junger and Tim Heatherington, the latter tragically killed by shrapnel in Libya in 2011. Hollywood movies do not ask the difficult strategic questions.

Should the US invade or interfere in countries it knows little about, how do US troops win over local support, is nation-building and promotion of democracy feasible by one part of the US government while another part pursues a war strategy? Can the US ever understand tribal societies through the barrel of a gun?

Hollywood has left us devoid of any understanding of the escalating global chaos.

That is until now. A remarkable new film, War Machine starring Brad Pitt, which at first whiff sounds like a gonzo-type war movie, brilliantly portrays these themes outlined above. David Michod, the Australian writer and director, and Netflix have made a movie that is both dark and satirical, emotional and belly-laugh funny, as well as being educative about US interventions.

The film is based on a character similar to former Nato commander US General Stanley McChrystal (R) The script is based on the Rolling Stone magazine article and subsequent book The Operators: The Wild and Terrifying Inside Story of America’s War in Afghanistan, by the late journalist Michael Hastings. His article led to the 2010 sacking of Stanley McChrystal, the US general in charge of the war in Afghanistan, after he and his staff officers made disparaging remarks about President Barack Obama to the journalist. The movie tells the story leading up to Gen McChrystal’s dismissal.

The casting of Pitt as Gen Glen McMahon, the imagined McChrystal who is beloved by his men but also full of comic eccentrics, is near perfect. Pitt plays his role partly as absurdist comedy but also as someone who is on a steep learning curve on how to win or lose modern wars.

Full of bluster and self confidence, Gen McMahon arrives to take charge in Kabul after another general had failed. “Let’s go win this thing,” and “Let’s knock this on the head,” he tells his military aides – a coterie of equally brilliant actors whose cameos act as foils for Gen McMahon’s slow realisation that he is only repeating what other generals before him have tried and failed to do.

Gen McMahon cannot get the additional US troops he needs because Mr Obama is reluctant to send any. Gen McMahon cannot stop Afghan farmers from growing poppy because, officials tell him alternative crops like cotton would be competing with US farmers.

Fellow NATO officers teach Gen McMahon a new reality. “You can’t build a nation at gunpoint” and “you can’t win the trust of a country by invading it”, he is told.

Karzai played by Ben Kingsley.

A cynical President Hamid Karzai, superbly played by Ben Kingsley (with all of Mr Karzai’s habitual tics), hears out Gen McMahon describing how he will mark out a new direction. “We will build Afghanistan into a free and prosperous nation,” says Gen McMahon. “Sounds a lot like the old direction,” Mr Karzai replies with a knowing smile.

Several dark yet truthful encounters speed up Gen McMahon’s understanding. A troubled and angry US marine played by Lakeith Stanfield questions how his contradictory strategy can work. Trained to kill, the marines is now told he must show “courageous restraint”.

“I can’t tell the difference between the people and the enemy,” says the marine. “They all look alike to me. We can’t help them and kill them at the same time. I am confused,” he states.

Actress Tilda Swinton, playing a German politician, tells Gen McMahon that “you are spread all over the country and fighting 1,000 separate battles with local people who don’t want you in their villages and that is a war you will never win”. The general is gob-smacked into silence.

The film will not get a wide cinema release because it is showing on Netflix. However, this is a film that should particularly be shown at universities and colleges, and discussed amongst young and old. It helps us understand why counter-insurgency is failing, terrorism expanding and why wars have destroyed so many countries. It helps explain why after 16 years Washington is still debating troop numbers.

Contributing editor Ahmed Rashid is a Pakistani journalist and author based in Lahore. His latest book is Pakistan on the Brink – The Future of America, Pakistan and Afghanistan. Earlier works include Descent into Chaos and Taliban, first published in 2000, which became a bestseller