Ian Ayres and William Eskridge are law professors at Yale University.

Controversy over a Russian law that prohibits advocacy of homosexuality threatens to overshadow athletic competition at the upcoming Sochi Olympics. Thoughtful world leaders, including President Obama, have criticized Russia for stigmatizing gay identity.

Many of these critics find it hard to believe that in 2014 a modern industrial government would have this kind of medieval language in its statutory code:

●“Materials adopted by a local school board . . . shall . . . comply with state law and state board rules . . . prohibiting instruction . . . in the advocacy of homosexuality.”

●“Propaganda of homosexualism among minors is punishable by an administrative fine.”

●“No district shall include in its course of study instruction which: 1. Promotes a homosexual life-style. 2. Portrays homosexuality as a positive alternative life-style. 3. Suggests that some methods of sex are safe methods of homosexual sex.”

●“[I]nstruction relating to sexual education or sexually transmitted diseases should include . . . emphasis, provided in a factual manner and from a public health perspective, that homosexuality is not a lifestyle acceptable to the general public and that homosexual conduct is a criminal offense.”

Amid the rush to condemn Russia’s legislation, however, it is useful to recognize that only the second quoted provision comes from the Russian statute.

The other three come from statutes in the United States. It is Utah that prohibits “the advocacy of homosexuality.” Arizona prohibits portrayals of homosexuality as a “positive alternative life-style” and has legislatively determined that it is inappropriate to even suggest to children that there are “safe methods of homosexual sex.” Alabama and Texas mandate that sex-education classes emphasize that homosexuality is “not a lifestyle acceptable to the general public.” Moreover, the Alabama and Texas statutes mandate that children be taught that “homosexual conduct is a criminal offense” even though criminalizing private, consensual homosexual conduct has been unconstitutional since 2003.

Eight U.S. states, and several cities and counties, have some version of what we call “no promo homo” provisions. Before the United States condemns the Russian statute’s infringement of free speech and academic freedom, it should recognize that our own republican forms of government have repeatedly given rise to analogous restrictions.

It is no coincidence that these examples focus on what must and must not be said to children. An explanatory note accompanying the 2013 Russian legislation makes clear that the statute seeks to protect children “from the factors that negatively affect their physical, intellectual, mental, spiritual, and moral development.” Proponents of the U.S. statutes have offered similar justification. And, like Russian President Vladimir Putin this month, the U.S. laws warn gay people and sympathizers to “leave kids alone, please.”

The underlying ideology of these statutes is the same: Everybody should be heterosexual, and homosexuality is per se bad. This ideology has never rested on any kind of evidence that homosexuality is a bad “choice” that the state ought to discourage. The ideology is a prejudice-laden legacy of a fading era. (In fact, the strategy is daffy: Even if homosexuality were a bad lifestyle choice, state laws are not an effective way to head off such a choice.)

Putin has assured the International Olympic Committee that the law is merely symbolic. But in the United States, officially sanctioned anti-gay prejudice has contributed to classroom bullying and to the high level of suicides among gay teens.

The actor and playwright Harvey Fierstein has called on the United States to boycott the Sochi Games because Russia prohibits “propaganda of homosexuality.” But recall that in 2002 the United States proudly, and without comment, sent its Olympic athletes to a state — Utah — that prohibits the “advocacy of homosexuality.” Maybe Obama ought to send Olympic delegates Billie Jean King and Brian Boitano to Alabama and Texas.

We offer that suggestion somewhat tongue-in-cheek, but there is an important lesson here. Sometimes the moral failings of others can help us see moral failings in ourselves. It was revulsion toward Nazi Germany’s eugenics policy that, in part, caused U.S. legislatures and courts to renounce state sterilization programs. Opposition to South African apartheid and the Soviet Union’s totalitarian regime generated greater national pressure for the Eisenhower administration and the Warren court to renounce apartheid in the American South.

Putin’s inability to justify this law puts a spotlight on the inability of Utah, Texas, Arizona and other states to justify their gay-stigmatizing statutes. They should be repealed or challenged in court. Just as judges led the way against compulsory sterilization and racial-segregation laws, so they should subject anti-gay laws to critical scrutiny.

As things stand, one could imagine Putin responding to U.S. criticism by saying: “You hypocrite, first take the plank out of your own eye.”