BAKU (Reuters) - Around 800-1,000 people took part in the demonstration outside the Ministry of Education, far more than Azerbaijan's opposition has mustered in recent years to demand reform in the tightly-controlled former Soviet republic.
Twelve people were arrested, police said.
Some Islamic communities in mainly Shi'ite Azerbaijan complain of discrimination by a regime analysts say is anxious to stem any challenge from politicised Islam or radicalism as a potential threat to stability in the oil and gas exporter.
There is no explicit ban on the wearing of headscarves in schools, but the government this year introduced a standard school uniform which precludes traditional Islamic dress.
"My daughter and her friends aren't allowed into classes in hijabs, and that's unacceptable," said a female protester who declined to be named.
The country of 9 million people is bordered to the West by Turkey, where a secular state must accommodate growing conservative religious influences, to the south by the Islamic Republic of Iran and to the north by Russia's North Caucasus, gripped by an Islamist insurgency against Moscow.
LIMITED RELIGIOUS REVIVAL
Like much of the ex-Soviet Union, Azerbaijan has witnessed a limited religious revival since independence in 1991, but most Azeris still take a relaxed approach to their faith and only 10 percent say they pray regularly.
The protest followed comments on Thursday by Education Minister Misir Mardanov, who told reporters: "Every pupil of middle schools must come to classes in school uniform, and can wear anything else outside the school walls."
"They accuse me of being an unbeliever, but I believe there exist laws and they must be observed."
Under Azerbaijan's strict political system, such comments will carry considerable weight among headteachers.
Protesters held banners that read "Freedom for the hijab" and "Allahu Akbar" (God is Greatest).
But to many Azeris rooted in secularism, particularly in the booming capital Baku, a strong Islam runs contrary to their vision of a modernising Azerbaijan moving closer to Europe.
By Lada Yevgrashina