It’s been a while since the crew of the Starship Enterprise visited a strange new world in search of new life and civilizations. The Star Trek of television was full of strange new worlds; the Enterprise seemed to discover one every single week. The Trek movies, so focused on special effects, violence, and intricate revenge plots, have frequently strayed from Trek’s original mission. And while there’s plenty of action and excitement in Star Trek Beyond, there’s also a clear attempt to return this series to its core principles: Exploration, diplomacy, teamwork, and the hope for a better tomorrow. After the missteps of the punishingly bleak and the unfortunately rehashy Star Trek Into Darkness, it’s a necessary and welcome course correction; a Star Trek back into the light.

That doesn’t mean things are easy for the Enterprise crew. As the film begins, three years into the ship’s five-year mission (one of many winks to the original Trek series, which ended after three seasons on NBC), Captain Kirk (Chris Pine) feels lost in space. His Captain’s Log is unusually moody and reflective; 966 days into their journey “things have started to feel ... episodic,” and he desperate longs for a “break from routine.” At times, he confesses, he struggles to find the point in their work. Kirk is searching for purpose, and so is Star Trek, which is only fitting in the year of the franchise’s 50th anniversary. Trek was a property borne of the optimism of the late 1960s. Its sincere belief in a brighter future feels wildly out of place in the world of 2016. What’s the point of Star Trek today?

The exuberant Star Trek Beyond makes a convincing argument that the things that make Star Trek seem out of place in modern culture are the very reasons we need it now more than ever. The 1960s were even more tumultuous and racially divided than the 2010s; the diverse Enterprise crew showed what was possible when people of all races, genders, and creeds worked together to achieve common goals. It’s no coincidence that their opponent in Beyond is the embodiment of the nativist fear-mongering dominating this season’s Presidential politics, or that his weapon literally tears people apart. The film’s message of strength in unity couldn’t be timelier.

That villain is named Krall, played by Idris Elba beneath a mountain of prosthetic makeup. For reasons that aren’t immediately clear, Krall lures Kirk and company into a trap in a remote part of the galaxy. His army, a legion of warriors who pilot hundreds of tiny ships that swarm through space like metallic bugs, rips the U.S.S. Enterprise to shreds, stranding the survivors on a distant planet with no way of contacting the Federation and no hope of rescue.

That plot gives director Justin Lin (Fast & Furious) and writers Doug Jung and Simon Pegg (who also plays wisecracking engineer Scott), the chance to test their message by splintering the crew into four distinct groups. While Kirk and Chekov (the late Anton Yelchin) search the Enterprise wreckage for survivors, Dr. McCoy (Karl Urban) tends to a wounded Spock (Zachary Quinto). Meanwhile, Sulu (John Cho) and Uhura (Zoe Saldana) reckon with Krall’s twisted ideology as Scotty teams up with one of the planet’s alien inhabitants (Sofia Boutella) to find a way home. Breaking the crew into groups brings equal weight to all of their struggles; Kirk may be the Captain, but everyone plays an important role. Krall’s forces move with a singular hive-mind; they all wear identical, dehumanizing uniforms. His fascist dictatorship stands in stark contrast to the Enterprise’s multicultural (and multiplanetary) makeup and Kirk’s democratic approach to decision-making.

In the Fast & Furious series, Lin showed a rare talent for blending big action sequences with small character moments from a cast that felt like real family. All of that serves him well here; there are several impressive visual set-pieces (the destruction of the Enterprise is as harrowing as it is exciting) and an equal number of moments where each of the classic Trek team gets to shine. He finds ways to make these icons people again. Sometimes it’s as simple as giving Bones a line like “You gonna call your mom?” when he asks Kirk about his upcoming birthday over a glass of scotch. Sometimes it’s as profound as giving Sulu a family, and a personal stake in defeating Krall (his husband and daughter live on the space station targeted for destruction). So many blockbusters this summer have missed those kinds of humanizing notes, and for all their impressive technical wizardry, their action sequences seemed stale and lifeless as a result. Star Trek Beyond’s chases and battles aren’t necessarily better; in fact, a couple are too chaotic for their own good. But they all feel important, because Lin, Pegg, and Jung give us reasons to care about the characters.

Though it’s made at the scale of a modern Hollywood tentpole, Star Trek Beyond has the soul of the quirky, personal indies Pegg co-wrote and starred in for director Edgar Wright, which blended genre trappings with rich themes and ideas. This movie isn’t just fun; it’s sincere and sweet and downright inspiring. At a time when the nightly news feels increasingly apocalyptic, Star Trek Beyond offers an upbeat alternative. In its rejection of the politics of fear, Star Trek Beyond is hopelessly out of touch with the zeitgeist. But sometimes being in touch with the zeitgeist is overrated. This movie doesn’t put a mirror up to society, it shines like a beacon pointing a way forward, if only we’re bold enough to take it.