Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

An Illinois school district is breaking federal law by denying a transgender student full access to the girls' locker room, the Department of Education said Monday.

In a letter to Township High School District 211, the Department of Education’s Office for Civil Rights (OCR) said the district violated Title IX, which prohibits education discrimination on the basis of sex.

The decision was the result of a nearly two-year-long investigation into the Palatine, Illinois, district's policies, sparked by an ACLU complaint filed on behalf of the transgender student, who has identified as a girl for years.

The 2013 complaint said that the student, who has decided to keep her identity private, had legally changed her name and undergone hormone treatments and was largely recognized by the school as a girl.

She was allowed to use the girls' bathroom and participate on female sports teams at the Chicago-area high school but was barred from changing in three female locker rooms and instead was forced to use a separate bathroom, the complaint said.

The student "was 'crushed' by the district’s treatment of her, which she said indicated the school did not accept her as female," the OCR wrote Monday. "She wanted to be like every other girl."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"She wants to be accepted for who she is and to be treated with dignity and respect — like any other student.”

After months of negotiations with OCR, the district decided in October that transgender students could change in the locker rooms of the gender they identify with — but would have to use a curtained-off area.

"After serious and lengthy consideration, the District will continue to provide private accommodations for transgender students to ensure a respectful school environment, and will not allow unrestricted access to its locker rooms as directed by OCR," the district said in a statement on Oct. 12.

District Superintendent Daniel Cates said that the district doesn't believe it has violated the law, that he believes the district is sensitive and accommodating to transgender students, like changing names on school records and providing access to bathrooms and locker rooms. "But we request that they observe a measure of individual privacy when showering and changing clothes," he said.

Cates said in a column in a local newspaper and a front-page letter in Township 211’s newsletter that the reason behind the administration's resistance was to protect privacy rights of all 12,000 students in the district's five high schools.

"The mandated policy that OCR attempts to impose on District 211 would have national precedent-setting implications," Cates wrote in the Daily Herald. "The potential loss of federal funds is significant, but we believe the loss of appropriateness, reason and privacy for teenagers is also significant."

Be sure to read the Superintendent's guest column in the Daily Herald: http://t.co/oB535iDStf — Twp HS District 211 (@HSDistrict211) October 16, 2015

The OCR said the transgender student “has not only received an unequal opportunity to benefit from the district’s educational program, but has also experienced an ongoing sense of isolation and ostracism throughout her high school enrollment" because she was required to change behind a designated curtain or outside of the girls' locker room.

“All students deserve the opportunity to participate equally in school programs and activities. This is a basic civil right,” the OCR’s assistant secretary for civil rights, Catherine Lhamon, said Monday. “The district can provide access to this student while also respecting all students' privacy.”

The ACLU’s Illinois chapter on Monday lauded the OCR’s decision. "What our client wants is not hard to understand. She wants to be accepted for who she is and to be treated with dignity and respect — like any other student,” said John Knight, director of the LGBT & HIV Project of the ACLU of Illinois.

.@usedgov stands with IL student who is transgender, finds Palatine Dist. 211’s in violation of Title IX https://t.co/YS8WzXC8Ha #twill — ACLU of Illinois (@ACLUofIL) November 2, 2015

The student said she was “extremely happy.”

“The Department of Education’s decision makes clear that what my school did was wrong," she said in a statement. "I hope no other student, anywhere, is forced to confront this indignity.”

Township High School District 211 did not immediately respond to requests for comment, but said in its statement in October that “OCR’s unilateral mandate does not consider the best interests of all District 211 students and their families.”

The district has 30 days to reach a solution with the OCR. If they cannot, the district could have their federal funding suspended or terminated, according to the Department of Education.