Kenya's top court has overturned a 2016 Court of Appeal ruling that allowed Muslim students to wear hijab in non-Muslim schools.

In Thursday's ruling on the petition filed by the Methodist Church of Kenya, the Supreme Court said every school has a right to determine its own dress code.

The hijab is a headscarf worn by many Muslim women who feel it is part of their religion.

The 2016 ruling came after a church-run school banned female students from wearing the hijab, saying that it sowed discord.

Kenya has had a long-running dispute over the role of the hijab at Christian schools, with some of them banning the hijab outright in the past.

Around 10 percent of the Kenyan population practices Islam, while 84 percent follows Christianity, according to the Kenya National Bureau of Statistics.

Some Kenyans took to social media to criticise the decision, especially as the ruling comes after the country's Ministry of Education allowed turbans in schools for students of different religions which require head coverings, including Rastafarians.

A Muslim wearing a Hijab is forbidden but

a Rastafarian having a Rasta hair.

a mukorino with her scarf.

a Sikh with his turban.

All this is allowed in our schools.

Hijab is not just a piece of cloth in a girl's head but an act of worship.@FredMatiangi@dkmaraga #Kenya — Mohamednoor Daudi Ismail (@mnoor_daudi) January 24, 2019

Others believe that by pursuing this, the church was not sticking to its main principles.

"The church that talks about love your neighbours as you love yourself, peace, respect, and tolerance took the Muslims to court to force us not wear hijabs if we want to be part of their school community," Zahra Ubah, a student, told Anadolu news agency.

3. Banning #Hijab in High Schools is much a violation as it is to force them wear the #Hijab. I wonder with what happened to equality and liberty in Kenya, we should all hang out heads in shame. — Ayub Sh Abdikadir (@AyubAbdikadir) January 24, 2019

Mohamed Bamursal, a social activist, criticised the ruling, saying: "Totally out of order! This is against the tenets of our constitution. Freedom of worship, Hijab is an act of Worship. It's a wakeup call! Take your daughters to schools owned by Muslims!"