HOPKINTON, MA - APRIL 21: Governor Deval Patrick speaks to the media after the start of the Mobility Impaired division of the 118th Boston Marathon on April 21, 2014 in Hopkinton, Massachusetts. (Photo by Alex Trautwig/Getty Images)

Massachusetts Gov. Deval Patrick (D) signed an extensive package of gun control measures on Wednesday, according to the Associated Press.

The legislation allows police chiefs to ask courts to deny firearms identification cards needed to buy guns to individuals they feel are unfit to obtain them, toughens penalties for some gun-based crimes, creates an online portal for background checks in private gun sales, carves out a firearms trafficking unit within the state's police department and requires that Massachusetts join the National Instant Background Check System.

Gun control advocates hailed the measures as ones that make Massachusetts "a leader for the rest of the nation."

“With the stroke of Governor Patrick’s pen today, Massachusetts is now a leader for the rest of the nation in passing common-sense gun reform while continuing to respect the Second Amendment rights we all value,” Molly Malloy, the leader of Massachusetts' chapter of Moms Demand Action, said in a statement. “The single most effective thing we can do to keep guns out of dangerous hands and reduce the number of Americans killed with guns every day is require criminal background checks on all sales to close the loophole that allows felons, domestic abusers and the dangerously mentally ill to buy guns. Real leadership is what will keep guns out of the hands of dangerous people, and we are grateful to have leaders on this issue taking action to protect our families in the commonwealth.”

State lawmakers from both parties agreed on the package of measures in July. The legislation was supported by both gun control advocacy groups and the Massachusetts Gun Owners Action League, though the National Rifle Association opposed the bill, arguing that government officials could abuse new licensing powers created with the legislation.

Businessman Charlie Baker, who is running for the Republican gubernatorial nomination to succeed Patrick, said in a candidate debate Wednesday that he would have signed the package of gun control measures, though he had previously avoided giving a definitive answer on whether he supported the provision allowing police chiefs to deny firearms identification cards to those they consider dangerous.