The United States Court of Appeals for the Fourth Circuit this week held unconstitutional a Virginia law prohibiting the recognition of same-sex marriage. This was the twenty-ninth consecutive judicial decision in the past 12 months holding that such are laws unconstitutional. This is nothing short of extraordinary. How did we get to this point?

In 1996, only 27 percent of Americans supported the legalization of same-sex marriage. In that year, Congress, by overwhelming majorities, enacted the Defense of Marriage Act (DOMA), which denied federal marriage benefits to legally-married same-sex couples and authorized states to refuse to recognize same-sex marriages performed in other states.. In the years since then, more than 30 states have amended their state constitutions expressly to forbid the recognition of same-sex marriage.

In supporting these laws, our elected representatives were fearsome in their contempt for same-sex marriage and their condemnation of homosexuality. Oklahoma Congressman Tom Coburn declared “homosexuality is based on perversion.” Florida Congressman Charles Canady thundered that only opposite-sex marriage “comports with . . . our Judeo-Christian moral heritage,” and Indiana Congressman Stephen Buyer proclaimed that the very notion of same-sex marriage constituted “an attack upon God’s principles.” Georgia Congressman Bob Barr warned that “the flames of hedonism . . . are licking at the very foundations of our society.”

Nonetheless, today, only 18 years later, 55 percent of Americans support same-sex marriage. But that doesn’t explain the avalanche of judicial decisions invalidating laws prohibiting marriage by same-sex couples right and left. There are lots of laws that the majority of people don’t like that courts don’t hold unconstitutional. Unpopular and unconstitutional are not the same thing.

The plain and simple truth is that courts are holding these laws unconstitutional for two reasons: First, the Supreme Court has opened the door to these decisions. Second, this is the correct result.

The Supreme Court opened the door with three decisions of its own, all written by Justice Anthony Kennedy. In Romer v. Evans (1996), the Court, in a 6-3 decision, held unconstitutional a provision of the Colorado constitution that prohibited the enactment of any law protecting gays, lesbians, and bisexuals against discrimination. In Lawrence v. Texas (2003), the Court, in a 6-3 decision, held unconstitutional a Texas law prohibiting consensual, adult, homosexual intercourse (sodomy). In United States v. Windsor (2013), the Court, in a 5-4 decision, held unconstitutional the DOMA, which denied federal marriage benefits to same-sex couples who were legally married under the law of a state that recognized such unions. After these three decisions, it was clear to our nation’s judges that laws discriminating against gays, lesbians, and bisexuals could not withstand constitutional scrutiny. Justice Kennedy had taken his time over the past 18 years to gradually and incrementally bring the law around to the place it needed to be. Now we are there.

The multitude of decisions invalidating laws prohibiting same-sex marriage have rested on three different rationales. They all rest on the Equal Protection Clause of the Fourteenth Amendment, which was adopted after the Civil War and which provides: “No State shall . . . deny to any person the equal protection of the laws.”

Over the years, the Supreme Court has identified three types of situations in which laws violate this guarantee. First, laws that treat people differently from one another without a rational justification are unconstitutional. Second, laws that treat people differently from one another with respect to a fundamental right are unconstitutional, even if they are rational, if they lack a compelling justification. Third, laws that treat people differently on the basis of their race, sex, national origin, or similar “suspect” bases are unconstitutional, even if they are rational, if they lack a compelling justification.

All three of these reasons have been relied upon by courts in the past year to invalidate laws forbidding same-sex couples to marry.

Some courts have held that the distinction between same-sex and opposite-sex couples in terms of marriage serves no rational justification. Although conceding that the distinction is traditional and comports with some faiths’ religious beliefs, these courts have held that neither of those justifications can constitutionally sustain the discrimination. Other justifications, such as procreation and the raising of children, have been dismissed as bogus. In the view of these courts, the “real” justification for prohibiting same-sex couples to marry has nothing to do with rational public policy and everything to do with prejudice, intolerance, and ignorance – and those are not rational justifications.

Other courts, like the Court of Appeals in its decision this week, have held that marriage is a fundamental personal right and that government cannot constitutionally allow some people to marry, while denying other people that right, on the basis of a mere rational justification. Imagine a law, for example, prohibiting people who have been divorced from marrying, or prohibiting people who cannot have children from marrying, or prohibiting criminals from marrying. All of those laws may be “rational,” but none of them would be constitutional, because they do not serve a compelling government interest.

Finally, still other courts have held that, like laws that discriminate against African-Americans, Hispanics, women, religious minorities, political dissenters, and people from particular national origin groups, laws that discriminate against gays and lesbians are presumptively unconstitutional. This is so because such groups have historically been subjected to pervasive discrimination, which gives rise to the suspicion that laws that disadvantage such groups, even if rational, are likely to be colored by prejudice, animus, and unfair stereotype.

For what it’s worth, I would incline to the third of these arguments, primarily because it extends to all sorts of laws that discriminate on the basis of sexual orientation, even if they don’t touch on a fundamental right. For example, a law prohibiting gays and lesbian from teaching in a public school or serving in the military should be held to violate the Equal Protection Clause even if no fundamental right is implicated.

Although different courts have relied on different arguments to reach the conclusion that laws prohibiting same-sex couples to marry are unconstitutional, all three of these arguments make sense. And the good news is that in the next year the Supreme Court will finally come out of the closet and say so. It is, I believe, what Justice Kennedy has been waiting for.