Image copyright AP Image caption Teenager Gavin Grimm identifies as male

The US Supreme Court has temporarily overturned a ruling that allowed a transgender high school student to use the bathroom of his choice.

It is the first time that the fraught discussion over transgender bathroom rights has reached the country's highest court.

Judges voted 5-3 to halt a lower court's order that Gavin Grimm, 17, be allowed to use the boys' bathroom.

They will consider the case again in the autumn.

Mr Grimm who was born female, filed the lawsuit after his school board in Virginia adopted a policy that required students to use a private toilet or one that corresponds to the sex listed on their birth certificate.

An appeals court ruled earlier this year that the ban was discriminatory and violated Title IX, a federal law which prohibits gender discrimination at schools that receive federal funding.

The issue has gone back and forth between several different courts which have made opposing decisions.

As the Supreme Court is yet to rule definitively on the matter, it has set things back to the way they used to be, ahead of its eight justices beginning to hear the case in autumn 2016.

Mr Grimm appealed to the court not to discuss the matter, local media report, but its actions are exactly what the school board asked for.

Image copyright Reuters Image caption Gender-neutral toilets are becoming more common in some parts of the US

A divisive issue

A number of places in the US - most recently North Carolina - have passed laws requiring transgender people to use a public toilet that corresponds to the sex listed on their birth certificate.

The North Carolina law in particular has been sharply criticised as discriminatory and several companies have stopped doing business in the state as a result.

Some people have said that allowing transgender people to choose their restroom could lead to women and children being attacked.

They said they feared that predatory men could pose as transgender people and use legal protections as a cover.