The people of Palatine, Ill., a middle-class suburb of Chicago marked by generic strip malls and tidy cul-de-sacs, had not spent much time debating the thorny questions of transgender rights. But in late 2013, a transgender high school athlete, so intent on defending her privacy that she is known only as Student A, took on her school district so she could use the girls’ locker room.

After the federal Department of Education’s Office for Civil Rights ruled in her favor last fall, the two sides cut a deal: Student A could use the locker room and the school would install private changing areas. Some in the community denounced the arrangement; others joined the American Civil Liberties Union of Illinois, which represented the girl, in declaring a victory for civil rights.

Now the whole nation is in a pitched battle over bathroom access, with the Obama administration ordering all public schools to allow transgender students to use the bathrooms of their choice. Across the country, religious conservatives are rebelling. On Friday, lawmakers in Oklahoma became the latest group to protest, proposing one measure to effectively overturn the order, and another calling for President Obama to be impeached over it.

How a clash over bathrooms, an issue that appeared atop no national polls, became the next frontier in America’s fast-moving culture wars — and ultimately landed on the desk of the president — involves an array of players, some with law degrees, others still in high school.