The ruling by the Lagos division of Nigeria's Court of Appeal "has restored hope in the judiciary as the last hope of the common man," said the director of the Muslim Rights Concern group, Ishaq Akintola.
The unanimous decision, overturning a 2013 ruling which banned hijabs in Lagos government schools, has added authority since three of the five judges are not Muslim, Akintola said.
The headscarf issue has ignited passions in a country suffering from Boko Haram's Islamic uprising in the northeast. Some suicide bombers, including men disguised as women wearing full hijab, have hidden explosives under their robes.
Thursday's ruling came in response to an appeal against a Lagos state ban, which had argued that hijabs are not part of the approved school uniform.
More From This Section
The hijab controversy has been most heated in the mainly Christian, southwestern Osun state. The High Court there ruled last month that any harassment of girls wearing the hijab constituted an infringement of their rights.
The local branch of the Christian Association of Nigeria had accused Osun state Governor Rauf Aregbesola, a Muslim, of supporting the hijab as part of an "Islamisation" agenda.
Secretary-General Ishaq Oloyede of the Supreme Council for Islamic Affairs in Nigeria has suggested the controversy is a campaign by Christian extremists to force Muslim girls into an unacceptable choice between schooling and Islam.