Science fiction is not a genre. The most successful literary tradition of the 20th century is as impossible to neatly categorise as the alien life forms it sometimes imagines. But "sci-fi" does contain genres. The rigorous scientific speculation of Hard SF. The techno-cynicism of Cyberpunk, or its halfwit cousin Steampunk. The pulp fictions of Planetary romance and the dark visions of the sci-fi Post-Apocalypse. These genres flow in and out of fashion like the solar winds. After years condemned to the outer darkness of secondhand bookshops, Space Opera is once again exciting the imagination of sci-fi fans.

At the box office Guardians of the Galaxy has resurrected the kind of camp space adventure made popular by Flash Gordon, while on the printed page Ancillary Justice by Ann Leckie has scooped the prestigious double honour of Hugo and Nebula awards. Stories of space exploration have never lacked popularity. In the early 20th century when it was still possible to think space might be crowded with alien civilisations, stories like EE "Doc" Smith's Lensman series were immensely popular. But as we probed the reality of outer space we found only infinities of inert matter and a barren solar system.

Mars was not striated with canals hiding the lost civilisation of Edgar Rice Burrough's John Carter stories. There were no secret messages from the makers of the universe encoded in the transcendental number Pi and no signals game from a distant star welcoming us to the United Federation of Planets. It seemed we were alone, and the edgy possibility that space opera stories might reflect the un-glimpsed reality of outer space gave way to the blunt realisation that these were fantasies, plain and simple.

Far from showing us the universe, space opera reflected and amplified our earthly conflicts. Star Trek presented itself as a utopian future, but it was a utopia complete with blunt racial caricatures of America's enemies as Soviet Klingons and inscrutable oriental Romulans. Libertarian author Robert Heinlein used space opera to play out his militarist social fantasies in novels like Starship Troopers. Isaac Asimov's Foundation series made science the ultimate saviour of humankind, its only hope against the irrational forces of human nature, a fantasy Richard Dawkins would certainly appreciate. Our inter-galactic future, it seemed, would repeat the brutal empires, futile warfare and oppressive social structures of the past, but on a grander scale.

It was resistance to this idea that inspired a very different kind of space opera. Led by British writers influenced by the earlier New Wave, the New Space Opera explicitly challenged the politics of the genre. M John Harrison's The Centauri Device depicted the future as a hyper-capitalist nightmare, an absurdist satire of western materialism inflated to a galactic scale. Iain M Banks's most famous creation, the Culture, is a galaxy spanning egalitarian society, the complete opposite of the militaristic fantasies of much space opera, and a big part of the joy in reading his novels is watching the fun-loving hippies with guns overpower one brutal galactic empire after another.

Today space opera is a battlefield for competing fantasies of the future. As America plunged in to renewed militarism after 9/11, sci-fi books again began to mirror real-world wars. Baen books specialises in works of "military SF" that, behind their appalling prose styles and laughable retro cover designs, speak to a right-wing readership who can recognise the enemies of America even when they are disguised as cannibal lizard aliens. Baen's chief editor Toni Weisskopf went so far as to issue a diatribe against any and all sci-fi that did not pander to this conservative agenda.

So the success of a novel like Ancillary Justice unfolds against a background of ongoing political strife within space opera. Anne Leckie's novel builds upon foundations laid by Ursula Le Guin and Iain M Banks among others. Her vision of the future is one where empires rule the galaxy, but Ancillary Justice is an overt critique of the ways that power is used and abused. It continues the tradition of feminist writing within science fiction, famously adapting its pronoun usage as the central character struggles to understand the alien concept of binary gender.

This battle for the political high ground, while it is often petty, is far from unhealthy. The future science fiction has forecast and helped to shape, the future we are now deeply enmeshed in, is a profoundly political place. That today's science fiction writers engage with, reflect on, and fight over that future is a sign of an artform in fine health.