There’s no question that progress on gay and lesbian rights owes a lot to success in the courts. From the repeal of sodomy laws to the right to marry, the courts–especially the Supreme Court–have been the most reliable vehicle to secure secure basic rights.

So, as the transgender rights movement picks up speed, it’s worth asking: will the same strategy work as well?

The quest for transgender rights also has a few things going for it that gay and lesbian rights did not. For one thing, the transgender movement has been able to capitalize on the groundwork gay rights cases offers. Also, transgender activists have friends in high places.

The problem with relying on the courts is that judges can be way ahead of public opinion, prompting a backlash. The Supreme Court kicked marriage equality down the road for just this reason; Justice Ruth Bader Ginsburg has cited the Court’s Roe v. Wade abortion ruling as “too far, too fast,” leading to an endless culture war and mixed public opinions.

When it comes to transgender rights, public opinion is divided. More than half of Americans in a Pew Survey said that gender is determined at birth. Even among millenials, opinions are evenly split.

The other problem with the courts is that they can only go so far in the absence of laws. That’s why same-sex couples can be married anywhere but also fired for being gay in large swaths of the country.

Ultimately, success turns on public attitudes. Marriage equality shows that the public can be moved in the right direction, and rapidly. Knowing someone gay made a big difference. So did having a popular culture that celebrates gay and lesbian people. On that last count, the transgender movement has made some important headway.

Will transgender rights ultimately prevail in the courts? Undoubtedly there will be roadbumps, particularly with a federal judiciary stacked with ultra-conservative appointees.

Sometimes the courts are ahead of the public, as Ginsburg warned. But when public opinion shifts, sometimes the courts have no choice but to follow.