TRENTON -- Transgender students at New Jersey's public schools were given new layers of protection under a bill that Gov. Chris Christie signed into law Friday.

The legislation (S3067/A4652) -- which takes effect immediately -- requires the state education commissioner to draft specific guidelines to help schools address "the needs" of transgender students and establish policies that "ensure a supportive and nondiscriminatory environment" for those students.

Schools will be expressly told that they cannot force transgender students to use bathrooms or locker rooms that conflict with their gender identity.

Instead, schools would be be mandated to provide "reasonable alternative arrangements if needed to ensure a student's safety and comfort."

Schools will also be required to make sure transgender students are addressed by the name and pronoun they prefer, regardless of whether a legal name change has occurred.

In addition, the law tells schools they must allow students to dress according to their gender identity, create confidentiality plans to make sure employees do not disclose a student's transgender or transition status, issues school documents and identification cards to make the student's gender identity, and let students take part in gym class with the gender that matches their identity.

The move appeared to be an about-face for Christie. In March, the Republican governor said it should be up to individual school districts to draft policies regarding transgender students and refused to issue statewide "edicts" on the issue.

Christie did not explain why he signed the Democratic-sponsored bill.

Both houses of the Democratic-controlled state Legislature passed the measure last month -- the Senate by a vote of 25-10 and the Assembly by a vote of 59-15-3.

"These guidelines are needed to ensure that transgender students can safely be themselves without fear of being persecuted, and can help promote a culture of understanding and acceptance that will hopefully influence how students treat each other in and outside of school," said Assemblywoman Valerie Vainieri Huttle (D-Bergen), one of the sponsors.

Another sponsor, Assemblywoman Marlene Caride (D-Bergen), added: "If we cultivate intolerance, children will pick up on that and think it is OK to bully others who are deemed different."

State Sen. Teresa Ruiz (D-Essex), another sponsor, said "all of our children deserve to be treated with respect and dignity, and that means having the regulatory framework in place to be sure that our schools are safe places and have supportive environments for all students."

The bill was introduced after President Donald Trump this year rescinded federal guidance from President Barack Obama's administration that public schools must let transgender students use bathrooms and locker rooms that are consistent with their gender identity.

Though state law already barred New Jersey school districts from discriminating against transgender students, some school districts still tried to stop students from using bathrooms and locker rooms that matched their gender identity.

The state Department of Education last year said school districts should pass policies explaining how they handle issues related to gender identity, but the department stopped short of suggesting what those policies should say.

This law would clarify that.

New Jersey Family Policy Council, a conservative group that champions family values, spoke out heavily against the measure.

Len Deo, the organization's president, warned about the possibility of "opposite biological sex access" to student bathrooms and locker rooms and said teachers and students should not have to use pronouns chosen by transgender students.

Deo added that decisions about transgender policy should "be a local issue between parents, students, and the school board."

Christie signed the bill on the same day he signed another measure (S3017/A4568) into law that prohibits state-regulated health insurers, healthcare plans for public workers and teachers, and Medicaid from discriminating in providing coverage or services based on gender identity.

That law takes effect Nov. 1.

NJ Advance Media staff writers Adam Clark and Sophie Nieto-Munoz contributed to this report.

Brent Johnson may be reached at bjohnson@njadvancemedia.com. Follow him on Twitter @johnsb01. Find NJ.com Politics on Facebook.