Notwithstanding the most recent spate of mass shootings, over the past weekend, the prospects for gun-control legislation in Congress appear remote. The reason is no mystery. The National Rifle Association and its allies in the gun lobby maintain a firm grip on the Republican Party, including President Trump, and thus on veto power over the passage, or even the consideration, of measures to curb gun violence. But the power of the N.R.A. extends beyond its control of the legislative and executive branches of the federal government. It’s less well known that the N.R.A. has also transformed the judiciary and, in the process, rewritten our understanding of the Second Amendment to the Constitution.

For about two hundred years, the meaning of the Second Amendment was clear and mostly undisputed, despite the gnarled syntax of the text itself: “A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.” Generations of Supreme Court and academic opinion held that the amendment did not confer on individuals a right “to keep and bear Arms” but, rather, referred only to the privileges belonging to state militias. This was not a controversial view. The late Chief Justice Warren E. Burger said, in 1991, that the idea that the Second Amendment conferred a right for individuals to bear arms was “a fraud on the American public.” Burger was no liberal, and his view simply reflected the overwhelming consensus on the issue at the time.

But, starting in the nineteen-seventies, the N.R.A. undertook a patient and extensive effort to change the public, and eventually the judicial, understanding of the Second Amendment. As David Cole recounts in his book “Engines of Liberty,” the N.R.A. recognized that its path was blocked by binding precedents in the federal courts, so it turned to a state-by-state approach. Embracing and passing gun-rights legislation in the states, Cole writes, “fostered a legal culture in which the right to bear arms enjoyed a privileged place.” At the same time, the N.R.A. sponsored academic research that purported to show that the traditional understanding of the Second Amendment was incorrect. The movement reached its climax in 2008, when the Supreme Court, in Justice Antonin Scalia’s opinion in District of Columbia v. Heller, rewrote its understanding of the Second Amendment, and concluded that the Framers of the Constitution had, after all, intended the Amendment to confer an individual right to bear arms. (As Adam Gopnik recently observed, Justice John Paul Stevens’s dissent had the better argument, but Scalia’s opinion had the five votes.)

Read More Past New Yorker coverage of mass shootings and the battle over gun control.

Cole, who is now the national legal director of the American Civil Liberties Union, draws an important parallel to the N.R.A.’s effort to transform the meaning of the Second—that is, the movement to guarantee a constitutional right to same-sex marriage. Of course, these two efforts to change the political trajectory of the country went in opposite ideological directions. But the strategies behind them were remarkably similar. In both cases, the legal terrain, especially in the federal courts, was clearly hostile. In both, the movement for change began succeeding at the state level, and, in both, the culmination came at the Supreme Court. With regard to both gun rights and same-sex marriage, the Court ultimately yielded to a political movement that had mobilized legislators, academics, and ordinary citizens.

There is a lesson in these politically divergent victories for the current moment. Though the Supreme Court has been cautious since 2008 in expanding gun rights, there is every likelihood that the new conservative majority will frustrate federal or state legislative efforts to insure gun safety. In other words, even if Congress or states manage to pass laws restricting gun rights—including limits on assault weapons or even requiring universal background checks—there is a real possibility that a majority of the Justices will overturn these laws as violations of the Second Amendment.

But the lesson of the fight over gun rights—like that over the protection of same-sex marriage—is that the Constitution remains a political document that is subject to the ideological forces of the time. No victory, or defeat, is permanent. The Court changed the Second Amendment, and the Court can change it back again, in its original direction. This kind of change takes significant resources and enormous patience. At the moment, the future of gun control looks grim in all three branches of the federal government. Trump is President, the Republicans control the Senate, and conservative appointees dominate the Supreme Court. Control of the elected branches is up for grabs in less than a year and a half. Control of the Supreme Court will, of course, take much longer to change. But even the Court usually bends with public and political opinion over time, and that change may yet happen on guns. The grim lesson of recent weeks is that the need for that transformation has never been greater.