Hamas has been running Gaza since its violent takeover of the crowded coastal territory in 2007. While the group advocates the establishment of an Islamic state in all of the Mideast, including Israel, it has moved cautiously in spreading its ultra-conservative version of Islam.
It has issued a series of rules restricting women or requiring them to cover up in the traditional Islamic dress of long robes and headscarves.
Other edicts include bans on women smoking water pipes in public, riding on the backs of motorcycles or getting their hair done by male stylists. Last month, it barred girls and women from participating in a U.N.-sponsored marathon, prompting a U.N. aid agency to cancel the race.
Hamas activists, including teachers, have also exerted social pressure to get all school girls to wear Islamic dress.
When faced with public resistance, Hamas tends to refrain from enforcing the rules. It scrapped a 2009 decree requiring female lawyers to wear headscarves in court after women protested.
"In the last six years, Hamas has been going forward and sometimes a step backward because of protests but there is a strategy to implement the Islamic law in society," said Mkhaimar Abu Sada, a Gaza political analyst and university lecturer.
In conservative Palestinian society, the idea of gender segregation in schools from the onset of puberty is widely accepted. Even in the West Bank, run by a more liberal Western-backed self-rule government, most public schools separate boys and girls by fourth grade.
But in the West Bank, separation is not mandated by law. Instead, it's up to local authorities to decide according to residents' sensibilities.
The new Gaza law, approved Monday, deprives teachers and parents of that choice, and in principle imposes segregation on four private schools that have boys and girls studying together into middle or high school. They including three Christian-run schools and the American International School, with a total enrollment of 3,500. Officials at the schools had no comment on the new law.
A prominent women's rights group on Tuesday denounced the legislation.
The bill is "based on a culture of discrimination against women, by reinforcing gender separation which takes our society back to ancient times when there was no respect for women's rights and women were eliminated from public life," said the Center for Women's Legal Research and Consulting, Gaza's only legal aid group for women.
"We warn against issuing law that change Palestinian society," the group said.
A Gaza education official said the law is in keeping with local mores.
"We are a Muslim society and we all respect our religion," said Walid Mezher, the Education Ministry's legal adviser. "The aim is not to enforce Islam, as some people are saying ... It's simply to honor the traditions and the culture of the society."
Mezher noted that the education law deals with a host of issues, including improving the standing of teachers. "The law has 60 articles, and the media focused on one footnote?" he said.
Gaza has 690 schools with 466,000 students. Of those, 397 schools are public, 243 are run by a U.N. aid agency for refugees and 46 are private. The U.N. system has separate schools for boys and girls.
In addition to legislation, there has been mounting social pressure on Gaza girls and women to wear headscarves and robes. Earlier this year, a branch of Al-Aqsa University in the southern town of Khan Younis made it a requirement for all female students to wear robes in addition to headscarves.
Zeinab al-Ghnaimi, head of the women's legal aid group, said one of her female cousins who studies at the Khan Younis school defies the edict by not wearing a robe, though she does cover her hair with a scarf. Al-Ghnaimi said so far her cousin has faced no repercussions.
In majority Muslim Iraq, the law requires boys and girls in both public and private schools to study separately from age 12, when they enter secondary school. In some schools, segregation begins in elementary school. The law does not ban male teachers from teaching girls, but the Education Ministry prefers female teachers for girls.
In Pakistan, schools are not segregated by law, and boys and girls study together in the lower grades, but they tend to be separated at the start of secondary school.
In Jordan, gender segregation is left up to private and public schools. In 1990, Muslim Brotherhood Cabinet ministers declared a ban on gender mixing in public high schools sports. It is still in effect.
In Lebanon, there is no gender segregation law, and private and public schools are allowed to handle the issue as they see fit.
Public and private schools in Morocco are integrated at all levels, except for Quran schools influenced by Salafi preachers espousing a fundamentalist version of Islam.
In the Gulf, the rules generally encourage gender separation in classrooms for native residents. There are also many schools for foreign workers and residents, including Indians, Europeans and others, that allow co-ed classes.
Nammari reported from Jerusalem. AP writers Sinan Salah in Baghdad, Zeina Karam in Beirut, Paul Schemm in Rabat, Morocco, Brian Murphy in Dubai, United Arab Emirates, Jamal Halaby in Amman, Jordan, and Rebecca Santana in Islamabad contributed.