HARTFORD (AP) — Gov. Dannel P. Malloy of Connecticut signed into law on Thursday sweeping new restrictions on weapons and ammunition magazines similar to the ones used by the man who fatally shot 20 children and 6 educators at Sandy Hook Elementary School in Newtown.

Alongside family members of some of the victims of the shooting, Mr. Malloy signed the bill hours after the General Assembly approved the measure, which lawmakers said gave the state some of the toughest gun laws in the country.

“This is a profoundly emotional day for everyone in this room,” said Mr. Malloy, a Democrat. “We have come together in a way that few places in the nation have demonstrated the ability to do.”

The legislation adds more than 100 firearms to the state’s assault weapons ban and creates what officials have called the nation’s first dangerous weapon offender registry as well as eligibility rules for buying ammunition. Some parts of the bill took effect immediately after Mr. Malloy’s signature, including background checks for all firearms sales.