Congratulations to the gay-rights community for its victory in Obergefell v. Hodges. Anyone familiar with liberty's history in our country knew that the American people, sooner or later, would reach this point. But with unprecedented speed (President Obama campaigned in 2008 against gay marriage), gays won a sweeping right to marriage equality thanks to a 5-4 majority of the Supreme Court.

While many will welcome the ends, we may all come to regret the means. Taken together with this term's other blockbuster case, King v. Burwell, which upheld Obamacare's health-insurance subsidies, Obergefell only accelerates the loss of democratic self-government to a slim majority of the nine unelected justices of the Supreme Court.

No one can seriously claim that the Framers of our Constitution or of the 14th Amendment, which guarantees  both due process and the equal protection of the laws, understood gays to have a right to marriage. Our Constitution sets out certain core rights necessary for self government — free speech, criminal justice rules, for example — and requires all officials of the three branches of government, and indeed states as well, to devote their fullest efforts to protection of these rights.

But for everything else, our Constitution relies on the political process for decisions. For select national issues such as defense or interstate commerce, we turn to our elected representatives in Washington. Our federal system reserves most other questions in life, such as crime, family law, property, contracts, and accidents, to the states.

Elected officials do not just set tax rates, establish militaries, or build roads. They also create rights and establish entitlements. Some of our nation's most central rights, such as Social Security or the ban on workplace  discrimination, did not come as gifts from the Supreme Court. Instead, these policies came after years of rough-and-tumble politics and represented a broad social consensus.

Obergefell short-circuits the political process. Instead of campaigning to persuade majorities in each of the 50 states, as it had done in some states, gay-marriage advocates only had to convince five justices to impose a single rule on the nation. While many may welcome Obergefell's result, its method takes a fundamental question away from the realm of democratic self-government and transfers it into the hands of five men and women who never stand for election and hold their jobs for life.

Indeed, the political nature of Obergefell becomes readily apparent in the contradictory, vague logic of the majority opinion by Justice Anthony Kennedy. The holding fits within none of the established precedents governing the due-process and equal-protection clauses. Kennedy says marriage is a fundamental right, but he admits that American society had long understood that right to be only between a man and a woman. He suggests that the right to equality may require gay marriage, but gays do not receive the heightened constitutional protection reserved for racial and religious minorities. Kennedy could have recognized that gays should receive the same protections against discrimination as gender, but he could not because recognizing sexual orientation as a protected class might open up a Pandora's box of new constitutional claims by every self-defined group.

Some will respond that society was moving in the direction of gay marriage anyway, and that the court was following the popular will. If that is the case, then the court should allow the political process to work. Justices have no special expertise in divining the wishes of the American people. Indeed, as Justice Antonin Scalia noted in dissent, the justices are a strange bunch. They mostly hail from the same regions of the country, went to the same schools, hold similar religious beliefs, and have the same professional backgrounds. An isolated, expert Supreme Court makes perfect sense when the Constitution defends minority rights against the oppressions of the majority, but it makes no sense when settling policy reserved for democratic politics.

In fact, judicial seizure of an issue from the political process may make the consensus in favor of gay marriage less settled. Take abortion, for example. In the years leading to Roe v. Wade, states had been liberalizing their abortion laws. Roe prevents political resolution of the abortion issue and leads to constant efforts to narrow or reverse abortion rights through litigation, not political persuasion.

Gay marriage will remain subject in the future to the whim of a fifth justice who might choose to side with Chief Justice John Roberts and Justices Scalia, Clarence Thomas, and Samuel Alito. If gay marriage had resulted from the decisions of the majorities in each of the 50 states, it would be far more difficult, if not virtually impossible, to reverse. While the end of segregation by Brown v. Board of Education provides an all-important counter-example, legal historians today are coming to believe that racial equality accelerated far faster thanks to Congress' passage of the Civil Rights Act of 1964 and the Voting Rights Act of 1965.

Unfortunately, the court does not limit its dismissal of democracy to gay rights, but even extends it into less momentous questions of the running of the welfare state.

In King v. Burwell, which involved issues of political significance but of no constitutional moment, the justices again displayed their suspicion of politics. In King, plaintiffs challenged the Obama administration's nationwide grant of subsidies for the purchase of health insurance. According to its plain text, the Affordable Care Act extended the tax credit only to those who purchase a policy on an "exchange established by the state." Even though the act defined "state" to include only the 50 states and the District of Columbia, but not the federal government, the Obama administration granted tax credits to buyers in states with no exchanges. Thirty-six states refused to set up insurance marketplaces, leaving only an exchange run by the Obama administration as an option.

The ACA's plain meaning may well have stalled Obamacare by making health insurance unaffordable in the states without tax credits, but still requiring that everyone purchase it (an unconstitutional use of federal power upheld, unfortunately, three years ago by Roberts' fifth vote). This tough result emerged from the political process in Congress. It may have been a mistake, a wrong decision, or a ham-handed move to force states into signing up with Obamacare. If Congress made a poor choice, it was up to Congress to fix it, or for the voters to replace their representatives in Washington.

But instead of allowing the political process to run its normal course, the Supreme Court decided to rewrite Obamacare. On behalf of a six-justice majority, Roberts concluded that Congress could not possibly have intended such a draconian limit on tax credits. It must have meant to give the subsidy to everyone, because that would have made for a more effective overhaul of the health-care system. In other words, the court ignored the plain text of the law passed by Congress to write a better one. The justices may have better legal talents than the average legislator, but our Constitution does not give them the responsibility to make the compromises and judgments reserved to the legislative process.

Sadly, Roberts penned the central dissent in Obergefell on the ground that the majority was rewriting the Constitution. "Under the Constitution," he wrote, "judges have power to say what the law is, not what it should be." But if he wonders where his colleagues got the idea to assume the power of a supra-legislature, he need only look at his own opinion in King v. Burwell. This fault, however, is not his own, or in his stars, but is common to a court that is slowly, but surely, taking away the right of our democracy to govern itself.

John Yoo is a law professor at the University of California at Berkeley, a visiting scholar at the American Enterprise Institute, and a former official in the Bush Justice Department.  jyoo@law.berkeley.edu