The highest court in Massachusetts ruled today that the state's attorney general has the power to regulate handgun safety under consumer protection laws.

The unanimous ruling paves the way for the nation's first consumer regulation of firearms, which are generally exempt under federal law from state health and safety standards that apply to products ranging from toasters to toy guns.

In its 21-page decision, the Supreme Judicial Court rejected arguments by the gun industry that former attorney general Scott Harshbarger overstepped his authority and violated federal law when he issued regulations in 1997 mandating handgun safety devices and quality control standards.

"It's a huge victory for gun control advocates and makes Massachusetts the first state to regulate guns as we regulate all other consumer products," said Kristen Rand, director of federal policy for the Violence Policy Center, a gun control group in Washington.

"We hope it will spur state legislatures to enact similar laws and ultimately push the federal government to pass legislation to regulate the industry," Rand said.

Attorney General Thomas Reilly, Harshbarger's successor, said the ruling reaffirmed the authority of his office to crack down on unfair and deceptive trade practices. The regulations ban the sale of handguns with easily removable serial numbers, handguns made of inferior materials, and handguns prone to accidental discharge when dropped. Trigger locks and child-resistant devices are also required, among other measures.

"These are very common safety precautions that were directed at making handguns safer and really prohibiting so-called junk guns from being sold in this state," Reilly said.

The American Shooting Sports Council, the District-based industry group that filed the lawsuit, did not have an immediate comment. The group includes Smith & Wesson Corp., Glock Inc. and Sturm, Ruger & Co., among other manufacturers who are facing legal challenges from individuals and cities seeking to hold them liable for the costs of gun violence.

Earlier this year, a federal jury in Brooklyn found nine gun makers negligent for failing to exercise stringent controls over guns they sell. San Francisco and Los Angeles, meanwhile, are trying to use a state consumer protection law to force firearms manufacturers to halt the spread of their products to children and criminals. Massachusetts, however, is the first state to take such action.

In an unprecedented legal maneuver, Harshbarger sought to use his position's authority to regulate faulty consumer products as the basis for rules banning the commercial sale or transfer of handguns that did not meet safety and performance requirements. But last July, a Superior Court judge agreed with the industry that he had gone too far.

She issued a preliminary injunction blocking all but one of the regulations from going into effect, saying that gunmakers who sued Harshbarger demonstrated they were likely to win their case and would suffer "irreparable harm" if forced to modify their plants to comply with the new standards.

Massachusetts legislators, however, passed a new gun control law last year that includes many similar quality control and safety provisions. And today, the Supreme Judicial Court concluded the attorney general "sought to take preventative action as to defective handguns, consistent with the authority granted to him by the Legislature."