Saul Williams spent nearly a decade bringing his directorial debut “Neptune Frost” to the screen, but not even the multi-talented, multi-disciplinary artist could have scripted the mad dash it took to take his passion project from the rolling hills of East Africa to the Croisette in Cannes.

Shot on location in Rwanda over the course of 27 frenetic days, “Neptune Frost” had just wrapped principal photography last spring when the coronavirus pandemic began grounding planes and closing borders across the globe. “We made it back to the States on March 18, which was the last day it would have been possible to leave Rwanda,” Williams tells Variety. “We made it here with the film on our hard drives. It was a miracle that we made it to the finish line.”

The film’s premiere in the Directors’ Fortnight section of the Cannes Film Festival will mark the latest stage in a journey that began more than a decade ago, when the idea for “Neptune Frost” — first conceived as a graphic novel and Broadway musical — came to Williams. Set in a futuristic East African village made of recycled computer parts, it follows the love story between an intersex runaway and a coltan miner whose child will grow up to lead a subversive hacking collective exposing the evils of the world’s superpowers.

It is a manic, dystopian vision that was partly inspired by a trip to a market in Dakar, where Williams was filming “Tey,” from Berlin Silver Bear winner Alain Gomis (“Félicité”), in 2010. The director recalls being mesmerized by the sight of young Senegalese with iPhones and Beats headphones banging away on traditional sabar drums, something he describes as a “dialogue between the modern tech and the ancient tech.”

At the same time, Williams’ newsfeed was filling with stories about the Arab Spring, the rise of the Anonymous hacking collective, mineral extraction in Congo, and American evangelicals pushing African leaders to impose anti-LGBTQ laws. “I wanted to find a way to talk about all of this stuff under the helm of one project,” he says.

Williams and wife Anisia Uzeyman — a Rwandan actress, playwright and filmmaker he met on the set of “Tey” — developed “Neptune Frost” together. “I was waiting for an occasion to do something in Rwanda,” says Uzeyman, who co-directed and lensed the film and called it “the perfect set-up” to shine a spotlight on her country’s growing industry.

The two traveled together to Rwanda in 2016, where they began assembling a cast and crew drawn entirely from Rwanda, Burundi and Kenya. Two years later they launched a Kickstarter campaign that raised $196,000, with contributions from the likes of artist Kara Walker and “Hamilton” creator Lin-Manuel Miranda. It was an effort to sidestep the Hollywood “gatekeepers” who might expect him to compromise his artistic vision, says Williams; he then used the fundraiser as leverage to raise more than $1 million in additional financing.

The production team had to do much of the work in Rwanda from scratch, building sets and lighting units and jerry-rigged film equipment, all on a shoestring budget. At the end of each shooting day “we were on the phone…trying to raise money to shoot the next week,” says Williams, adding that both “Flash” star Ezra Miller and executive producer Stephen Hendel (“Fela! The Musical”) were instrumental in keeping the production afloat.

The result is a film that dovetails with Williams’ artistic and political convictions, at a time when the growing social justice movement makes his African sci-fi musical especially timely. “We’ve always known that it was a fight to be seen, to be heard, to be recognized,” he says. “We are here now. To be at a place creatively where…we can say, ‘This is the film I wanted to make,’ it does something. It’s powerful.”