The Massachusetts Attorney General's office called on a Malden charter school Friday to "immediately" end its policy of banning students from wearing hair extensions, a rule that some have deemed racially insensitive to black students.

The Mystic Valley Regional Charter School came under fire last week after two black 15-year-old students, Deanna and Mya Cook, said the school was giving them detentions for wearing hair extensions.

Mystic Valley officials have said hair extensions are specifically banned because they could divide students "from dissimilar socioeconomic backgrounds."

The school also bans "drastic or unnatural hair colors or styles such as shaved lines or shaved sides or have a hairstyle that could be distracting to other students (extra-long hair or hair more than 2 inch in thickness or height is not allowed)."

The school says its hair style policy, including the extension ban, helps create an environment that lets students stay focused on education.

However, the Cooks said that black students are more likely to wear hair extensions than their white peers, therefore making the policy discriminatory.

In a letter Friday, the state attorney general's office said it is concerned the school's policy on hair treats black students differently than white students — which would be a violation of federal and state law.

The letter, signed by Genevieve Nadeau, chief of the civil rights division at the state attorney general's office, directed the school to end the possibly discriminatory policy and to stop punishing students who have hair extensions, "shaved sides," dyed hair or hair that's more than 2 inches in thickness or height.

The AG's office is currently investigating Mystic Valley over the controversy and said there seems to be "substantial evidence" that the school's hair style policy is not consistently enforced between white and black students — something the Cooks also alleged.

The letter cited photos on social media showing white students with dyed hair or "shaved sides" as evidence that enforcement of the policy is inconsistent and "unlawful."

The letter said Mystic Valley's policy is harsher than similar rules at other charter schools, "suggesting that there are less restrictive (and potentially less discriminatory) alternatives available."

On Monday, the American Civil Liberties Union of Massachusetts filed a complaint against Mystic Valley regarding the hair style policy.

According to the letter, the school's board of directors is scheduled to hold an emergency meeting Sunday night.

With reporting from WBUR's Newscast Unit