SAN FRANCISCO — A 15-year-old transgender student in California who claimed to have been beaten and sexually assaulted in a school bathroom recanted after a police investigation failed to back up his story.

The reversal left open the possibility the teen could be charged with making a false criminal report, said Connie Van Putten, a police department spokeswoman.

The student, who is biologically female but identifies as male, had told officers he was leaving a boy’s bathroom on Monday morning when three other boys he did not know pushed him inside a large stall and attacked him.

But officers could not substantiate certain elements of his statement, including the time frame, and he lacked any physical injuries to his head, face and hands, police said.

The student acknowledged he had made up the story during the follow-up interview, Van Putten said. She would not speculate on why he had lied.

The incident came as school districts across California are bringing their policies into compliance with a law that took effect Jan. 1 guaranteeing students the right to use the bathrooms and locker rooms that match the gender with which they identify.

Advocates who fought to get the law through the Legislature last year said the fact that the Hercules teen’s story appeared to be untrue does not minimize the harassment that transgender students routinely face.

Mario Trujillo, spokesman for the West Contra Costa Unified School District, said school officials are less concerned with punishing the student than making sure he gets the support he needs.

Since November, Hercules High has been dealing with the fallout from an on-campus fight involving another transgender student and three girls that was captured in a cellphone video. Jewlyes Gutierrez, a biological male who identifies as female, was charged with misdemeanor assault and said she had repeatedly complained about being harassed at school before she fought back.

The West Contra Costa Unified School District also has been responding to criticism over its handling of sexual harassment involving students. The US Department of Education’s Office of Civil Rights launched an investigation of the district after a female student was gang-raped outside a homecoming dance at another high school in 2009, the year after another girl at a third high school was raped in a classroom by two classmates.