KINGSTON, Jamaica — Jamaica's high court ruled Friday that a school was within its rights to demand that a girl cut her dreadlocks to attend classes, a surprise decision that touched on issues of identity and one the most recognizable symbols of the island's Rastafarian culture.

The ruling by the Supreme Court of Jamaica capped a two-year battle after the girl — then 5 years old — was told she must cut her dreadlocks for "hygiene" reasons to study at Kensington Primary School in a Kingston suburb.

A rights group, Jamaicans for Justice, had initially lent support to the family, saying the order for the girl to cut her dreadlocks amounted a denial of her freedom of expression and her access to education.

Others viewed the court battle as a stand against rules seen as discrimination against people who wear "natural" hair, including Rastafarians whose dreadlocks are part of their religious tradition.

The girl and her parents, Dale and Sherine Virgo, who both wear dreadlocks, plan to appeal, said their lawyer, Isat Buchanan.

“I will not be cutting my daughter’s hair,” Sherine Virgo said immediately after the ruling. “If they give me that ultimatum again, I will be moving her.”

Virgo’s daughter — now 7 years old and identified in court papers only as Z because she is a minor — was attending classes at the school after the courts delivered an injunction against the Ministry of Education, allowing her to go to school with her dreadlocks intact.

When the school closed this spring because of the coronavirus pandemic, the girl was home-schooled.

“I am more than surprised. It is most unfortunate,” Buchanan said. “It is a most unfortunate day for Black people and for Rastafarian people in Jamaica.”

The girl’s father called the ruling another sign of “systemic racism.”

“A child was refused because of her Black hair, you know?” said Dale Virgo. “It’s so weird that right now in the current climate of the world, in 2020, we are having protests, and Black people are fed up.

“This is an opportunity the Jamaican government and the legal system had to right these wrongs and lead the world and make a change,” he continued. “But they have decided to keep the same system.”

The judgment was delivered in a small courtroom populated mainly by lawyers and the girl’s parents.

The minister of education, Karl Samuda, declined to comment on the ruling, which came on the eve of Emancipation Day, celebrated in Jamaica and elsewhere to mark the end of slavery in the British Empire.

“I’m very cautious about where I tread,” he said, “especially on a sensitive enough subject like that.”

Verene Shepherd, director of the Center for Reparation Research at the University of the West Indies, said the government is debating issues of student clothing and hairstyles, including dreadlocks.

The Virgos say they do not identify as Rastafarian, but they say that wearing dreadlocks is an expression of their identity. All Virgo family members wear that natural hairstyle, as do many Jamaicans who identify as Rastafarian.

Though Rastafarians account for only about 2 percent of Jamaica’s population, the movement has an outsize influence in the culture. Made popular by perhaps the world’s most famous Rastafarian, Bob Marley, it is a political and religious movement that was founded in the 1930s, drawing from African, Revivalist and Christian traditions.

Despite its popularity, Rastafarians, and people who wear natural hair, still face discrimination in Jamaica.

Some schools, including Kensington Primary, explicitly state that dreadlocks are not allowed, and other schools have banned students who refuse to cut them. In the wake of the challenge, the Ministry of Education issued guidelines for hairstyles, including a directive that if children wear dreadlocks, they must be “neat.”

“In general, I think that discrimination on the grounds of hairstyle is wrong,” Shepherd said. “I do not think our children who are Rastafari and who express their culture through their hair should be discriminated against.”