The high court agreed Wednesday to allow the Gloucester County School board to bar Gavin Grimm from the bathroom that matches his current gender identity until the justices decide whether to review an appeals court ruling in his case.

The case is the first time the fight over transgender bathroom rights has reached the Supreme Court, and the subject arrived in the heat of a U.S. presidential election in which the makeup of the court is a central issue.

Grimm will be barred from the boys' bathroom when he returns to school in September. Grimm was born female but identifies as male. He was allowed to use the boys' restroom at school for several weeks in 2014.

A lawyer for the school board declined to comment on the Supreme Court's order.

A lawyer for Grimm, Joshua Block, said he and his client were disappointed by the order and "disappointed that Gavin is going to have to begin another school year being stigmatized and separated from his peers as a result of this policy."

The Gloucester County School Board had filed an emergency appeal with Chief Justice John Roberts, arguing that allowing Grimm into the boys' bathroom would "put parents' constitutional rights in jeopardy."

North Carolina and DOJ take bathroom battle to court

"Depriving parents of any say over whether their children should be exposed to members of the opposite biological sex, possibly in a state of full or complete undress, in intimate settings deprives parents of their right to direct the education and upbringing of their children," school board attorneys wrote to the Supreme Court.

Grimm sued the school board, arguing that it was violating federal education discrimination laws by barring him from the boys' room.

The 4th U.S. Circuit Court of Appeals sided in April with Grimm.

The school board says it plans to ask the Supreme Court to review the appeals court decision by late August.The high court put Grimm's federal discrimination lawsuit temporarily in limbo.

The eight-member Supreme Court voted 5-3 to stay the lower court's order. Justices Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan would have denied the school board's request that it be able to block a student from exercising choice in use of a bathroom, according to the order. Justice Stephen Breyer, of the Supreme Court's liberal wing, joined with its most conservative members in temporarily siding with the school board. Breyer wrote in a one-sentence explanation that he did so as a courtesy to preserve the status quo until the Supreme Court has a chance to consider the subject more fully.