Perhaps the finest film in the “Star Wars” franchise is “The Empire Strikes Back,” which is a bleak, dreary movie, downbeat and ominous.

The best “Star Wars” sequences are often in the darkest moments, when all hope is lost and the future looks dim. “Rogue One: A Star Wars Story” is a series of dark scenes, grim and dirty, and with all the foreboding doom of a film centered on the Death Star, a planet killer whose fury was on full display in the original classic “A New Hope.”

This stand-alone film, out Friday, is about the Rebellion’s quest to capture the plans for the Death Star. Much like “Titanic,” it’s a movie where we all know the ending, with “A New Hope” picking up directly afterward. But this is about the journey to that well-known conclusion, and what a journey it is.

It all starts on a remote, desolate planet where the scientist Galen Erso (Mads Mikkelsen) lives with his family after fleeing work on the Death Star. When a ship descends from the sky, he sends his daughter, Jyn, to a secret hiding space in a cave. The new visitor is Director Orson Krennic (Ben Mendelsohn), who is in charge of making the Death Star. He and his troopers abduct Galen to continue his work, leaving the young Jyn to be found and raised by the rebel Saw Gerrera (Forest Whitaker).

Fast forward 15 years or so, and the adult Jyn (Felicity Jones) is getting sprung from jail by the rebels for a very important mission. Galen has contacted the rebels with news of a powerful weapon, and how to defeat it. All they need to do is break into an Empire stronghold and steal the plans.

Led by the roguish Cassian Andor (Diego Luna), a ragtag group of soldiers — including Jyn and a smart-aleck droid, K-2SO (Alan Tudyk in a wonderful motion-captured performance) — are on the job.

“Rogue One” is a dense story, set over many locations and with a lot of characters. And it’s heavy. The stakes are high, and the knowledge of the events of “A New Hope” leave an impending sense of dread. We know this weapon, the Death Star, will be successful. And when you see the likes of Bail Organa of Alderaan (Jimmy Smits, returning to the role after “Attack of the Clones” and “Revenge of the Sith”), knowing the fate of his planet, it adds emotional weight to this story.

Yet the narrative is well-paced and actually very funny, thanks especially to Tudyk’s K-2SO and Donnie Yen’s Chirrut Îmwe, a Force-sensitive blind man who can take down a roomful of Stormtroopers with just his staff. Jones brings a toughness to Jyn, and Luna brings many emotional levels to Cassian and is a great straight man for Tudyk’s one-liners.

Director Gareth Edwards (“Monsters,” the 2014 “Godzilla”), working off a screenplay by Chris Weitz and Tony Gilroy, has created a world that feels lived in. The costumes look well-worn, the spaceships clearly have seen battle. The rebel base is dingy — with the bright white costume of Rebel Alliance leader Mon Mothma (Genevieve O’Reilly) as a stark contrast to the environment.

The action here is swift and exciting. This is the first “Star Wars” film that doesn’t focus on the Jedi and the Sith. It’s about the rebel soldiers and the generals of the Empire. It’s a tactical war film with covert attacks and street-level skirmishes.

In terms of its connections to the greater storyline, “Rogue One” certainly has the overarching connection — an explanation of a key plot point from “A New Hope” — but it also has some fun Easter eggs without beating you over the head with them.

“Rogue One” tells a great heist story and offers some new glimpses into the world of “Star Wars.” It’s a film that fans will love, and a great model for future stand-alone movies in the franchise.