A federal judge blocked a California law on Wednesday that would have made it illegal to carry a gun in most public areas. The judge reasoned that the law violates the Second Amendment of the US Constitution and robs people of their right to self-defense and the defense of those they love. The September-signed law by Governor Gavin Newsom was scheduled to go into effect on January 1. It would have made it illegal for anyone to carry a concealed weapon in 26 locations, such as zoos, churches, and public playgrounds. Regardless of a person’s eligibility for a concealed carry permit, the prohibition would still be in effect. One exception would be privately held companies that display signs indicating that firearms are permitted on their property. U.S. District Judge Cormac Carney granted a preliminary injunction blocking the law, which he wrote was “sweeping, repugnant to the Second Amendment, and openly defiant of the Supreme Court.” The court case against the law will proceed while the law is blocked. The judge wrote that gun rights groups are likely to succeed in proving it unconstitutional, meaning it would be permanently overturned. The decision is a victory for the California Rifle and Pistol Association, which sued to block the law. The measure overhauled the state’s rules for concealed carry permits in light of the U.S. Supreme Court’s decision in New York State Rifle and Pistol Association v. Bruen, which set several states scrambling to react with their own laws. That decision said the constitutionality of gun laws must be assessed by whether they are “consistent with the nation’s historical tradition of firearm regulation.” “California progressive politicians refuse to accept the Supreme Court’s mandate from the Bruen case and are trying every creative ploy they can imagine to get around it,” the California association’s president, Chuck Michel, said in a statement. “The Court saw through the State’s gambit.” Michel said under the law, gun permit holders “wouldn’t be able to drive across town without passing through a prohibited area and breaking the law.” He said the judge’s decision makes Californians safer because criminals are deterred when law-abiding citizens can defend themselves. State Attorney General Rob Bonta said his office will appeal the decision, which he said if allowed to stand “would endanger communities by allowing guns in places where families and children gather.” Newsom said he will keep pushing for stricter gun measures. “Defying common sense, this ruling outrageously calls California’s data-backed gun safety efforts ‘repugnant.’ What is repugnant is this ruling, which greenlights the proliferation of guns in our hospitals, libraries, and children’s playgrounds — spaces, which should be safe for all,” the governor said in a statement Wednesday evening. Newsom has positioned himself as a national leader on gun control while he is being increasingly eyed as a potential presidential candidate. He has called for and signed a variety of bills, including measures targeting untraceable “ghost guns,” the marketing of firearms to children and allowing people to bring lawsuits over gun violence. That legislation was patterned on a Texas anti-abortion law. Carney is a former Orange County Superior Court judge who was appointed to the federal bench by President George W. Bush in 2003. (with inputs from The Associated Press)