What a piece of work is ape.

It’s been nearly 50 years since the release of “Planet of the Apes,” the outlandish and weird and fantastic sci-fi cautionary tale featuring groundbreaking makeup work, a legendary performance from Charlton Heston and one of the most famously shocking endings in movie history (courtesy of “Twilight Zone” legend Rod Serling).

Numerous sequels and TV adaptations followed. Many were little more than campy nonsense.

Even the 2001 reset, directed by Tim Burton and starring Mark Wahlberg, Helena Bonham Carter, Paul Giamatti, et al., which made more than $350 million worldwide and had its moments, seemed superfluous. Perhaps we had gone as far as we could go with this premise.

So what a great and pleasant surprise it was when the franchise found new creative life a decade later.

Over the course of three socially relevant, action-packed, thought-provoking and thoroughly entertaining films, from “Rise of the Planet of the Apes” in 2011 to “Dawn of the Planet of the Apes” in 2014 to the new “War for the Planet of the Apes,” the focus has gradually shifted from the humans to the increasingly intelligent and empathetic chimps — a masterstroke of storytelling.

Directed with great flair and scope by Matt Reeves, “War for the Planet of the Apes” picks up the story some 10 years after “Dawn” (also directed by Reeves).

Still led by the wise, noble and ferocious but world-weary and physically aging Caesar, the apes have built a colony deep in the California hills and have tried to live peacefully, striving to avoid conflict and in fact avoid any contact with the humans who have survived the sweeping Simian Flu plague.

We open with an intense and gritty wartime sequence. American soldiers with anti-ape slogans scrawled on their helmets crawl through the brush, planning an ambush. This scene looks like something out of “Platoon” or “We Were Soldiers” or “Full Metal Jacket” — and it’s hardly the only time “War for the Planet of the Apes” will remind us of a superbly crafted Vietnam war film.

Once the battle is on, both sides suffer horrific casualties, rendered in a style telling us “War” is going to be more serious and much darker than most big-budget mid-summer blockbusters.

And a whole lot more captivating.

From that point forward, the film is told almost entirely from the point of view of the apes. Caesar’s mission is to find a land so remote the apes will be able to live and thrive without the constant threat of invasion from humans — but after a bloodthirsty American known only as The Colonel (Woody Harrelson) leads an attack on the compound, resulting in some deaths that hit close to home, Caesar cannot suppress his need for revenge.

Accompanied by the wise Maurice (Karin Konoval) and his loyal lieutenant Rocket (Terry Notary), Caesar sets out on seemingly suicidal mission to find the Colonel’s camp and take him out. Along the way, they pick up an elderly survivor that calls itself “Bad Ape” (Steve Zahn), and a mute little girl (Amiah Miller) who will be called Nova. (Caesar initially wants nothing to do with the human, but Maurice forges an instant parental bond with the child, and tells Caesar if they leave her behind, she will die — and Maurice can’t abide that.)

Director Reeves, who co-wrote the richly layered screenplay with Mark Bomback, makes it clear he’s taking us on a journey to the heart of darkness. (We even see “Ape-pocalypse Now” scrawled on the wall in a cave.)

Once our band of heroes locates the Colonel’s lair, “War” shifts from a road trip film to POW camp thriller, with Caesar and company plotting to free their brothers and sisters that have been captured, abused and used for slave labor.

With his shaved head and mad ramblings and hideous methods, the Colonel is an obvious cinematic descendant of Brando’s Col. Kurtz. Thanks to Harrelson’s laser-focused intensity, it’s a dominant portrayal of a man driven to madness by a world gone mad — yet in one scene, we even find just a little empathy for this tyrant when we learn exactly what drove him over the edge.

As jarring as it might seem initially to see apes riding horses and having conversations in English (though some still converse through sign language), in many ways “War” plays like a familiar albeit extremely well-made film about the horrors of war, and the unspeakable things people (and evolved chimps) will do in the name of protecting their loved ones and surviving to live another day.

The veteran cinematographer Michael Seresin (“Angel Heart,” “Harry Potter and the Prisoner of Azbakan”) deserves an Academy Award nomination for giving the film such a vibrant and stunning overall look. Serkis is brilliant and memorable and sometimes absolutely heartbreaking as Caesar. The supporting players excel, with each getting a moment or two in the sun.

If there’s one drawback in “War,” it’s the lack of a human character with any … humanity. Have ALL the good people been wiped out by the Simian Flu? From the viewpoint of this film, the dynamic between apes and humans has reached the point where even the humans “in charge” are clearly inferior to the chimps they so despise.

★★★1⁄2

20th Century Fox presents a film directed by Matt Reeves and written by Reeves and Mark Bomback. Rated PG-13 (for sequences of sci-fi violence and action, thematic elements, and some disturbing images). Running time: 133 minutes. Opens Friday at local theaters.