Kahiu's lawyers argued that banning the film violated her constitutional right to free speech and free expression as an artist.

Reacting to the high court judgment, Kahiu posted an emotional statement on Twitter.

"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," she said.

The court decision now makes 'Rafiki' eligible to be submitted for the Best Foreign Language film at next year's Academy Awards.

According to the Academy's rules, a film must be shown in the country where it was produced for seven consecutive days to be eligible.

The film will now be screened in the Kenyan capital Nairobi from September 23 until September 29, Kahiu said.

The movie made history in May this year as the first Kenyan movie to premiere at the Cannes film festival.

Inspired by the 2007 Caine Prize short story winner "Jambula Tree" by Ugandan writer Monica Arac Nyeko, 'Rafiki' which means 'friend' in Swahili is the story of friendship and tender love that grows between two young women amidst family and political pressures, according to the film's promotional material.

Being gay in Kenya

Kenya is highly conservative, and a vast majority of people hold negative views about LGBT people.

Kenya's penal code criminalizes "carnal knowledge against the order of nature." Anyone found engaging in gay or lesbian activities could face up to 14 years in prison.

Prompted by public uproar, the police arrested two men in 2015 and conducted forced anal examinations on them to prove they were gay.

In March this year, anal examinations were ruled unconstitutional by a Mombassa court of appeal. The court found that conducting forced anal examinations on people accused of same-sex relations is illegal, according to Human Rights Watch.

The ruling reversed a 2016 High Court decision that had upheld the Kenyan authorities' use of forced anal exams on men suspected of being gay.

Why was "Rafiki" banned?

The board said 'Rafiki' had same-sex scenes and undertones which were not in the script initially submitted for approval.

The director was asked to remove the scenes, but she refused.

The KFCB said in the statement that foreign sponsors who intend to introduce and normalize homosexuality in Kenya through movies should desist from such acts.

"Kenya is a country with a culture, beliefs and shared values which must be respected," it said.

"Hare-brained schemes by foreigners funding film producers in Kenya to promote homosexuality in the name of equality and inclusion will be exposed and strongly resisted," a spokesman for the board said.

Ezekiel Mutua who heads the censorship board said police would be present during the screening of 'Rafiki,' to ensure that only people over 18 were watching the film.

"It's a shame that someone thinks that gay content is what should define the success of the film industry in Kenya. Nollywood is doing wonders, and they don't pride in such nonsense!" he posted in a tweet.