The judge in that case concluded Gitari's concerns were "weighty and require debate", sending it to a bench of judges.
The groups that launched the legal challenge against the anti-gay laws said they plan to appeal Friday's court judgement to a higher court.
In a ruling that lasted nearly two hours and quoted both worldwide case law and national provisions protecting the family, culture and religion, the judges stated that the contested provisions do not target a specific group of people, but rather "any person", and therefore can not be considered discriminatory.
According to the International Lesbian, Gay, Bisexual, Trans and Intersex Association's 2019 roundup, consensual same-sex sex acts are still officially or unofficially criminalized in 70 U.N. member nations.
According to section 163 of the penal code, it states that, "Any person who attempts to commit any of the offences specified in section 162 is guilty of a felony and is liable to imprisonment for seven years". She said the ban on same-sex relationships "sends a unsafe signal to broader society and encourages hostility and even violence against LGBT individuals".
Gay rights are "not of any major importance" in the country, President Uhuru Kenyatta told CNN in an interview previous year. Kenyan LGBT activists argued that the Kenyan Constitution says the "state shall not discriminate directly or indirectly against any person on any ground", the Times reported.
It is their argument that the two sections are discriminatory and contravene various provisions of the Constitution such as the right to equality, freedom from discrimination, human dignity, freedom, security and privacy. Most oppose homosexuality as contrary to the teaching of the Bible and the Quran, and many pastors don't accept gays and lesbians in their churches.
In a remark prompting gasps and mutters from the packed courtroom, she said there was "no conclusive scientific proof that LGBTQ people are born that way".
"They devastate people's lives and have no place in a democratic Kenyan society", the Nairobi-based National Gay & Lesbian Human Rights Commission said after the decision was announced.
"We can not be another Sodom and Gomorrah", Alfred Rotich, a Catholic bishop, told Reuters at the court after the verdict.
Sheikh Hassan ole Naado, deputy secretary general of the Supreme Council of Kenya Muslims, said he never doubted how the court would rule.
The activist who filed the first petition against the laws in 2016, Eric Gitari, told The Associated Press after Friday's decision that "we are anxious that this is going to embolden people who do not like LGBT people in Kenya and give them justification to act arbitrarily in harming people".
The ruling on Friday will reinforce perceptions of Kenya's courts as being conservative on issues of sexuality, but other recent rulings in favor of LGBT rights had brought activists a degree of hope before the High Court decision.
"LGBT rights mean more than just gay rights".
Téa Braun, director of the Human Dignity Trust, told PinkNews that the judgment is "very significant for Africa, as it will be worldwide".
The ruling dealt a sharp blow to advocates for LGBTQ rights.