ANNAPOLIS -- Maryland Gov. Martin O'Malley signed into law Thursday some of the toughest new gun restrictions in the nation, though a lawsuit and possible voter referendum threaten the new measure.

The law takes effect Oct. 1 and bans the sale of 45 assault weapons and long guns that contain features similar to assault rifles; requires fingerprinting, licensing and training for new handgun purchases; reduces the number of bullets ammunition magazines can legally hold from 20 to 10; and prohibits gun ownership by the mentally ill.

"The legislation signed today takes a comprehensive, common-sense approach to help keep our communities safe while striking a balance between protecting the safety of law enforcement and our children, and respecting the traditions of hunters and law-abiding citizens to purchase handguns for self-protection," O'Malley said.

Gun rights groups have opposed the law at every step of the legislative process.

"We think it's sad that Maryland officials have ignored the Constitution and are now fingerprinting gun owners like sex offenders," Gun Owners of America spokesman Erich Pratt said after the bill signing. "These new restrictions will do nothing to make the citizens of Maryland safer because criminals never obey the gun laws."

The law was beleaguered before it was even signed, with the National Rifle Association in April threatening to challenge its constitutionality in court.

NRA spokeswoman Alexa Fritts did not respond to requests for comment on Thursday.

"The National Rifle Association's position and concerns will be made very clear when we file our lawsuit," Fritts wrote in an email Wednesday.

A Montgomery County activist also has organized a petition drive in an attempt to put the fate of the new gun law before voters in 2014. If Sue Payne, chairwoman of Free State Petitions, succeeds in collecting the required 55,736 valid signatures by the end of June -- more than 18,000 of which must be turned in by May 31 -- the gun bill and any lawsuits challenging it would be put on hold until after the 2014 election.

"We are looking to collect every signature we can and light up every voter in the state," Payne said.