NAIROBI — A judge in Kenya has temporarily lifted a ban on a film that features a lesbian love story, allowing its producers to fulfill the criteria necessary to submit it to next year’s Oscars as a nominee for Best Foreign Language Film.

The film, called “Rafiki,” which means friend in Swahili, depicts two young women from opposing political backgrounds who nevertheless fall in love. Kenya’s Film Classification Board banned it in April, saying it violated the country’s “family values.” Homosexuality is criminalized in Kenya, as it is in many former British colonies, and can carry up to a 14-year prison sentence. But Friday’s ruling on “Rafiki” may be a precursor to overturning those laws.

India and Trinidad and Tobago, also former British colonies, legalized homosexuality this year, with judges providing legal reasoning for why Victorian-era anti-sodomy laws were irreconcilable with the civil rights enshrined in their post-independence constitutions.

In her ruling on Friday, Judge Wilfrida Okwany said that she was “not convinced that Kenya is such a weak society that its moral foundation will be shaken by seeing such a film.”

Wanuri Kahiu, the film’s director, tweeted: “I am crying. In a french airport. In SUCH Joy! Our constitution is STRONG! Give thanks to freedom of expression!!!! WE DID IT! We will be posting about Nairobi screening soon.”

“Rafiki” has garnered numerous accolades over the summer, including an appearance at the prestigious Cannes Film Festival on the French Riviera. It was Kenya’s first entry at Cannes.

According to the Academy Awards rules, any nominee for Best Foreign Language Film must have been shown in its country of origin for seven straight days. Sept. 30 is the deadline for submissions. Judge Okwany’s temporary lifting of the ban on “Rafiki” — for a period of seven days — was designed to allow it to fulfill that requirement.

The head of Kenya’s Film Classification Board, Ezekiel Mutua, has been extremely vocal about his opposition to the film and is known for being a outspoken opponent of homosexuality. On Friday, after the ruling, he took to Twitter to voice his concerns.

“What a tragedy that anyone in their sane minds thinks homosexuality is what should define Kenyan film industry,” he wrote. “Shame on those foreign NGOs who want to use gay content as a tool for marketing the film industry in Kenya. If people want to screen the homosexual film in their houses that’s fine. We are watching to see which public theatre will exhibit it without the Board’s approval.”

Kahiu, the director, did not immediately respond to a request for comment on her plans to screen the film, but she told BuzzFeed News that she had been scouting sympathetic local cinemas.

“The undisputed fact is that the gay theme or the practice of homosexuality did not begin with the film Rafiki,” wrote Okwany in her ruling. She added that “one of the reasons for artistic creativity is to stir the society’s conscience even on very vexing topics such as homosexuality.”