Guns shops were jammed. Gun manufacturers were angry. Gun-control advocates were thrilled. Many legislators were torn.

But as President Obama on Tuesday announced a visit to Connecticut next week in the wake of an agreement on a far-ranging package of state gun legislation, Connecticut was bracing for the consequences, intended or not.

The most immediate result of the agreement, which came more than three months after the massacre of 26 children and educators in Newtown, was a run on gun shops on Tuesday, following months of already brisk sales. Gun owners are rushing to buy weapons, ammunition and magazines in anticipation of limits on their sale and possession.

A package of gun, mental health and school security legislation that leaders in the General Assembly agreed to on Monday includes a ban on the sale of magazines carrying more than 10 bullets and the registration of existing ones; an expansion of the existing assault weapons ban; background checks on all firearms sales; and a registry of weapons offenders. Lawmakers are expected to pass the legislation on Wednesday.

Vic Benson, co-owner of the Freedom Shoppe, a gun shop in New Milford, said that his store was not usually even open on Tuesday, but that he opened its doors in anticipation of panicked buyers, and also to get rid of inventory he thinks he will be unable to sell after lawmakers vote on Wednesday.

“We’ve got a fire sale going on here,” he said. “Whatever doesn’t sell by the time they pass this law is going to be useless. Basically, $100,000 worth of paperweights. ”

One customer, John Gursky, 22, of New Milford, was stocking up on 30-round magazines and ammunition he said he uses recreationally. “Nothing they’re trying to pass right now is going to help the crime rate. It’s only going to make it worse,” he said.

But legislators, many Sandy Hook Elementary School families, gun-control groups and big-city mayors praised the legislation.

On Monday, families representing 11 of those who died at Sandy Hook called for a ban on the possession of high-capacity magazines, which was not included in the final legislative package.

But Gov. Dannel P. Malloy, who had supported the ban, said on Tuesday that he would sign the legislation anyway. And Sandy Hook Promise, the group representing the families of the 11 victims, said that adding the requirement to register existing magazines strengthened the legislation considerably. “We thank the legislature for passing the strongest gun responsibility legislation in the nation,” the group said in a statement.

Not all the families of the victims were in agreement. Many have been silent on gun issues, and one parent, Mark Mattioli, whose son James, 6, died at Sandy Hook, appeared at the National Rifle Association’s news conference on Tuesday to praise its proposal to put armed personnel in the nation’s schools.

Urban mayors including William Finch of Bridgeport, John DeStefano Jr. of New Haven and Pedro Segarra of Hartford praised the legislation.

“It’s bipartisan legislation that’s worthy of the tragedy that befell our state and our nation in Newtown,” Mr. Segarra said.

Very much in doubt is the future of gun manufacturers in a state once known as the cradle of the American gun industry. Many gun makers, like other manufacturers, have long since left the state.

But according to the National Shooting Sports Foundation in Newtown, gun manufacturers in Connecticut account for 2,899 jobs — 7,340 including related businesses, such as suppliers — and have a $1.7 billion economic impact. They include giants like Colt Manufacturing; O. F. Mossberg & Sons, the oldest family-owned firearms manufacturer in America; and Stag Arms of New Britain, founded 10 years ago, which is unable to keep pace with its orders.

All of the companies have been wooed by other states, particularly those in the South and West.

Mark Malkowski, the 34-year-old founder of Stag Arms, said he grew up in New Britain, where the company is based, and had never before considered leaving the state. But he said he would consider it now.

“If our product is so bad, so dangerous, why would the state of Connecticut want us to produce it here, create jobs here, manufacture it here and ship it to all the other states?” he said.

Correction:

An article on Wednesday about a run on gun shops in Connecticut after the General Assembly reached a deal on gun-control legislation misstated a change under the bill. The legislation, signed into law on Thursday, includes a ban on the sale of magazines that hold 11 or more rounds and requires that owners of such magazines register them; it is not the case that the ban includes the sale of magazines carrying “10 or more” rounds and their registration. (The error was repeated on Thursday in an article about the passage of the bill in the state Senate.)

Robert Davey, Elizabeth Maker and Vivian Yee contributed reporting.

A version of this article appears in print on , on Page A19 of the New York edition with the headline: Legislative Deal Prompts Run on Connecticut Gun Shops. Order Reprints | Today’s Paper | Subscribe