NAIROBI — A Kenyan judge temporarily lifted a ban on an acclaimed film portraying a lesbian relationship on Friday, making it eligible to be entered for a Foreign Language Oscar, delighting the filmmakers but angering the censor.

"Rafiki" - "Friend" in Swahili - premiered at Cannes, the first Kenyan film to be selected by the prestigious festival.

Hailed by critics as a "sweet" romance about two young women who live in the same Nairobi housing estate, it was banned at home on the grounds that it promotes homosexuality, which is a criminal offense a colonial-era law.

Addressing a packed courtroom in Nairobi, Justice Wilfrida Okwany ordered the ban lifted for a week.

"During the seven-day suspension period, the film shall only be open for viewing to willing adults," she said as a number of people sighed with apparent relief, hugged each other and congratulated the lawyer representing director Wanuri Kahiu.

Okwany said the director was "hereby allowed to admit the film" to Kenya's Oscars selection committee.

"I am crying. In a french airport. In SUCH Joy! Our constitution is STRONG! Give thanks to freedom of expression!!!! WE DID IT!" Kahiu tweeted.

A Nairobi cinema announced it would screen the movie from Sunday.

But the Kenya Film Classification Board, which banned the movie in April, said it still considered "Rafiki" morally subversive.

"It is a sad moment and a great insult, not only to the film industry, but to all Kenyans who stand for morality, that a film that glories homosexuality is allowed to be the country's branding tool abroad," it said in a statement.

The judge said the film's depiction of a same-sex relationship has been "tolerable" to adult audiences in other countries including South Africa, where homosexuality, as in most of the continent, is also taboo.

"I am not convinced that Kenya is such a weak society whose moral foundation will be shaken by simply watching a film depicting gay themes," Okwany said.

The ruling comes as Kenyan rights activists fight to decriminalize gay sex, something that happened in India this month, raising hopes among gay right proponents in Africa.

FOLLOW NBC OUT ON TWITTER, FACEBOOK AND INSTAGRAM