“It’s not that they don’t care. It’s that they’ve given up.” This was how Commanding Officer Benjamin Sisko, played by Avery Brooks, described early 21st-century Americans in an episode from Star Trek: Deep Space Nine. When it aired in 1995, “Past Tense” spoke to contemporary concerns about homelessness by telling a story set in 2024—the near future for viewers, but the distant past for characters. In the two-part episode, Sisko and two of his companions from the U.S.S. Defiant find themselves stranded in San Francisco, where they’re reminded that the federal government had once set up a series of so-called “Sanctuary Districts” in a nationwide effort to seal off homeless Americans from the general population. Stuck in 2024, Sisko, who is black—along with his North African crewmate Dr. Julian Bashir and the fair-skinned operations officer Jadzia Dax—must contend with unfamiliar racism, classism, violence, and Americans’ apparent apathy toward human suffering.

The Star Trek franchise has, for 51 years, told plenty of stories about the political and social ills of American society. Deep Space Nine, which ran from 1993 to 1999, was no different. Set on an outpost for the peaceful United Federation of Planets’s defense and exploratory service known as Starfleet, Deep Space Nine tackled subjects such as terrorism, imperialism, and the limits of democracy during crisis. It was also the first Trek series to feature an African American commanding officer—a legacy that has been continued in CBS’s recently debuted reboot Star Trek: Discovery, which stars Sonequa Martin-Green as the show’s first black female lead.

The kind of storytelling Discovery is hanging its hat on, with flawed characters, multi-episode story-arcs, and a grittier outlook, was pioneered (for Star Trek at least) with Deep Space Nine. With Sisko at the helm, the series also introduced new concerns about race, family (Sisko was a widower and a loving father to his son, Jake), and what it means to be the representative of a far-away government on the (final) frontier. Looking back today, “Past Tense” still stands out for its surprisingly realistic, near-future vision of racism and economic injustice. And unlike the typically optimistic characters that occupy most of Star Trek, in “Past Tense” the people of 2024 are beaten down, exhausted, and weary of their world.

In science fiction, it’s common for the problems of the human condition to be addressed through allegory. Star Trek did this regularly. Throughout the series, aliens would stand in for different elements of an all-too-familiar debate about race, class, or gender. For example, the 1969 Trek episode “Let That Be Your Last Battlefield” tries to make a point about the absurdity of racism—via a ham-fisted story about an alien population that’s divided between individuals whose faces are half-white and half-black, and those who have the color scheme reversed. The allegory was obvious, but it elided the complexity of how racist societies operate.

“Past Tense” aired 26 years later, in the third season of Deep Space Nine. Combining a searing look at homelessness with an indictment of America’s refusal to tackle the crisis head-on, it was arguably the most straightforwardly political story Star Trek ever told. It dispensed with clumsy metaphors to examine public health and mental illness; it also confronted the effects of the country’s waning optimism following Lyndon B. Johnson’s “Great Society,” a series of domestic programs meant to end poverty and inequality in the ’60s. The script was also written and produced only two years after the Los Angeles Riots, which clearly influenced the story. The episode could perhaps have dug even deeper into its critique of bigotry. Still, “Past Tense” was notable for depicting racism not from the perspective of a well-meaning white liberal, as seen in previous iterations of Star Trek, but through the eyes of people of color directly threatened by violence and indifference.

* * *

Seeing the main characters thrust from the relative comforts of the 24th century into the despair of the 21st is jarring. Sisko and Bashir end up in a Sanctuary District, lacking the necessary identification cards to keep them from being rounded up by the local authorities. Dax, a member of the alien Trill species who looks like a young white woman, is lucky enough to be found by a wealthy member of the media who gives her new clothes and food, and makes her part of upper-crust San Francisco society. Bashir’s incredulousness at the plight of people in the Sanctuary Districts is meant to reflect the viewer’s outrage. “Why are these people in here? Are they criminals?” he asks Commander Sisko, who replies, “They’re just people without jobs or places to live.” The district’s inhabitants come from a variety of backgrounds, a reminder of how poverty cuts across race, gender, and age. What everyone there has in common—whether they are homeless, law enforcement, or an administrator—is anger at how the U.S. government has left them behind.

Where Bashir condemns American society, Sisko tells the doctor that, as Starfleet officers, they should have a longer view of history. According to Sisko—an expert on the 21st century—the social upheaval in San Francisco’s Sanctuary District plays a major role in triggering an event that will prove transformative for the country. The homelessness crisis leads to what will be known as “the Bell Riots,” named after its primary historical protagonist, Gabriel Bell, an African American man who dies in the clashes and becomes a national hero. The riots and their aftermath spur humans to become the kind of species that will, by 2161, form the enlightened United Federation of Planets.

Bell’s race gives the two-parter an eerie realism. His almost sacrificial death recalls pivotal moments in U.S. history when black Americans died violently and spurred others to ensure the nation lived up to its lofty ideals. The modern Black Lives Matter movement emerged following the acquittal of George Zimmerman in the fatal 2012 shooting of Trayvon Martin and gained wider prominence after the police killings of Michael Brown and Eric Garner in 2014. The assassination of Martin Luther King Jr. sparked the passage of the Fair Housing Act of 1968. A bombing that killed four little African American girls in Birmingham, Alabama, at the height of the civil rights movement galvanized public opinion against Southern segregation.

In “Past Tense,” things are complicated when Bell dies, ironically, trying to save Sisko and Bashir from a group of muggers within the Sanctuary District. Sisko takes on Bell’s name, knowing that his comrades’ unplanned presence in 2024 San Francisco risks damaging the larger timeline unless they can recreate the events of the riot. Because official records show that Bell died in the chaos, Sisko grimly concludes that he must take on that same task—for the sake of humanity and the Federation.

The episode’s emphasis on history is crucial. In every iteration of Trek, the captain has a special appreciation for the past. Captain James T. Kirk adored Abraham Lincoln. Jean-Luc Picard (The Next Generation) spoke fondly of the greatness of both France and his own family. Kathryn Janeway (Voyager) would, at times, reflect movingly on the progress women made on Earth. Captain Jonathan Archer’s own father (Enterprise) was a critical part of Earth’s early attempts in the 22nd century to advance warp travel. But for Sisko, a native of New Orleans, history spoke with a powerful, notably African American voice. Unlike the uplifting accounts other captains pointed to, Sisko indicated that he remembered humanity’s more vicious moments, too.

Sisko’s recollections of his family often included meditations on discrimination. In Season 7’s “Badda-Bing, Badda-Bang,” Sisko would refuse to participate in a holographic program set in 1962 Las Vegas due to its fanciful obliviousness of racial issues in that period. (“We cannot ignore the truth about the past,” Sisko insists.) In “Past Tense,” he immediately understands the significance of the Bell Riots, and is even willing to give his life to make sure history continues as it should. Because Sisko takes charge in the crisis, the previously belligerent security guards are willing to let him escape and to tell the world that “Gabriel Bell” died in the uprising. The Federation is saved, and the 21st and 24th centuries are saved. Nonetheless, Sisko, Bashir, and Dax are all profoundly shaken by the world that they’ve lived in for only a few days.

The creators of “Past Tense” confronted the story’s real-world analogues as they filmed it. Ira Steven Behr, one of the episode’s writers, recalled reading a Los Angeles Times report on then-Mayor Richard Riordan’s push to have the city’s homeless moved to enclosed spaces, both for their sake and for the benefit of local businesses. Behr also acknowledged the episode’s implicit racial commentary, noting for the Star Trek: Deep Space Nine Companion book that Sisko and Bashir—being people of color—were treated more harshly than Dax. He also recoiled from criticism that the two-parter was too one-sided in its portrayal of a country dealing with homelessness, telling Star Trek Monthly magazine in 1996 that, “People are still even writing that we only presented ‘one side’ in ‘Past Tense’ and that we should have presented ‘both sides’ and not just the ‘liberal’ point of view—and I’m still trying to think what that means.”

Watching from 2017, it would be easy and somewhat trite to say that the Trek writers “predicted” a divided America that seems to have forgotten its history—of slavery, of segregation, and of the hard work done to ease inequality in its many forms. But the final lines of “Past Tense” should serve as both a testament to the power of science fiction, and to how even the usually optimistic Star Trek was unsure of the near future. Bashir asks Sisko, “How could they have let things get so bad?” Sisko responds, “That’s a good question. I wish I had an answer.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.

Robert Greene II is a doctoral candidate in history at the University of South Carolina, specializing in 20th-century southern and African American history. His work has appeared in Jacobin, Dissent, and In These Times.