In state capitals and city halls nationwide, the National Rifle Association is demonstrating its enduring ability to thwart new firearms regulations and expand rights for gun owners — even after a school massacre in Newtown, Conn., gave the gun-control cause new momentum.

Just last week, Illinois state House members declined to consider proposed limits on assault weapons amid a surge of negative phone calls and e-mails from NRA members and other gun owners. In Wisconsin last week, legislators wary of provoking the NRA backed off a proposed ban on loaded firearms in the public gallery overlooking the state assembly chamber. In suburban Los Angeles, Glendale City Council members anticipate a packed and emotional meeting next week as a result of NRA-issued “grass-roots alerts” protesting proposed limits on gun shows. And legislators in at least seven states are weighing whether to allow public school staff members to carry weapons to work.

The local and state-level skirmishes underscore the obstacles that await President Obama and congressional Democrats as they prepare to push new gun-control measures in the face of stiff opposition from the NRA and its Capitol Hill allies — many of whom represent areas where gun ownership is a cherished value.

Gun rights advocates suffered a setback in the immediate aftermath of the Newtown shootings when Michigan Gov. Rick Snyder (R) vetoed a bill that would have allowed concealed weapons in schools, day-care centers and other public places. Another defeat came this week, when New York Gov. Andrew M. Cuomo (D) approved new bans on assault weapons and high-capacity ammunition clips. It was only by moving with extraordinary speed that the state prevented the NRA from mounting its typically muscular opposition.

The group and its allies, confident in their traditional ability to influence congressional action, consider state capitals the prime battlegrounds and are planning to shore up their influence where they may be vulnerable, such as Maryland and other Democratic-led states.

Many lawmakers naturally embrace and applaud the NRA’s aggressive defense of gun rights. Even legislative opponents speak in admiring terms of the group’s organizational skills, which they say can outmatch the most powerful interest groups — chambers of commerce, medical associations and police federations.

Obama acknowledged the importance of the NRA’s base as he presented his proposals Wednesday, saying that success in Congress would require support from “voices in those areas and those congressional districts where the tradition of gun ownership is strong.”

The NRA and its vast network of local affiliates achieve their success through a mix of skilled local lobbying and voter mobilization. Annual report cards rate legislators on an A-to-F scale based on voting records, and the group sends millions of blaze-orange postcards during campaigns to tout its friends or attack its enemies. As a reward to those with high grades, the NRA provides endorsements and campaign support. It also offers friendly lawmakers access to legal counsel and legislative research.

The organization, which has an annual budget of more than $200 million, directs campaign donations to its supporters in both parties, with contributions to federal campaigns totaling about $20 million in 2012, according to the Center for Responsive Politics. Comprehensive figures for state campaigns were not available.

But NRA officials and lawmakers on both sides say the group’s power stems mostly from its ability to activate its passionate membership.

With an e-mail alert system designed to target its 4.2 million members, the NRA can mobilize hundreds of gun owners in every community on short notice to turn out at a committee hearing or a city council meeting.

“What they do well is they really get people out,” said Illinois state Rep. Elaine Nekritz (D), who heads the House committee that was to consider the assault-weapons ban until gun owners, spurred by the local NRA affiliate, overwhelmed legislators with calls and e-mails. “That’s democracy. I can’t fault them for it. I have to applaud them for it.”

Nekritz, who supports the proposed ban, said her office received hundreds of phone messages and about 1,000 e-mails in the two days before she pulled the bill. “I didn’t see anything that was supportive,” she said.

The response resulted in part from work done by the NRA’s local affiliate, the Illinois State Rifle Association, which e-mailed its 20,000 members and contacted other gun owners statewide.

“Our base is passionate, and it’s big,” said Richard A. Pearson, executive director of the group. “The NRA is so powerful because millions of people in the United States think the NRA is doing the right thing.”

The post-Newtown efforts by gun rights activists follow two decades of success in transforming the policy and political landscape from the ground up. With the debate largely at a stand-off in Washington over the past 20 years, state after state has expanded gun owners’ rights, rolling back restrictions and, in many places, allowing people to bring guns onto college campuses, school grounds and the property owned by their employers.

Before 1987, when Florida approved a landmark law saying that anyone who can legally own a weapon shall be issued a license to carry it, 31 states prohibited or sharply restricted residents from carrying guns, according to an NRA report. The Florida law became a model that was widely adopted after state-level lobbying by the NRA. Today, only Illinois and Washington, D.C., maintain strict prohibitions. In addition, more than 40 states now have laws, drafted in part by the group, limiting the right of local governments to restrict guns — a response to efforts by several cities to regulate firearms.

Much of the NRA’s national agenda in the states originated in Florida, home to a large gun-owning population and a wily lobbyist, Marion Hammer, a 73-year-old grandmother and gun enthusiast widely considered the best of the NRA’s stable of state-level advocates.

Hammer gained national prominence when she pushed through Florida’s groundbreaking 1987 concealed-carry law. She has found success ever since as a front-line advocate for the NRA, consistently pressing for new measures that can serve as templates for other states.

Hammer, who declined to comment for this article, was the force behind a 2005 law that expanded the right of self-defense, beyond a person’s home. A part of the law, the “stand your ground” provision, gained national attention after the 2012 fatal shooting of Trayvon Martin, an unarmed teenager. Soon after the law’s passage, Hammer addressed a meeting of the conservative American Legislative Exchange Council, prompting it to adopt the Florida bill as a model for other states. Since then, about two dozen have passed a version.

More recently, Hammer helped usher through legislation that authorizes fines against any local officials or governments that restrict gun ownership — a measure that inspired a similar proposal in Pennsylvania.

And she was at the center of two of the NRA’s newest bills to come from Florida: measures that would restrict doctors from asking patients about gun possession and require businesses to let employees keep guns in their parked cars at work. In both cases, the NRA prevailed over other powerful lobby groups.

“The NRA gets what it wants,” said Mark Wilson, president of the Florida Chamber of Commerce, which successfully fended off the guns-to-work bill for years before losing in 2008.

At one point, Wilson and others recall, Hammer tangled in a closed-door session with top business lobbyists and Republican lawmakers, lecturing them about constitutional protections for guns. One of the lobbyists told her that businesses could prevent workers from taking anything onto a company’s property, even a Bible. Hammer relayed the Bible remark to a reporter, who wrote an article, prompting evangelical Christian groups to jump into the fray and join the NRA in opposing the business community.

The NRA’s clout was on display again in 2011 when the group bested another powerful GOP-friendly lobby — the Florida Medical Association — and helped win overwhelming passage of the measure restricting what doctors can ask patients.

Jeff Scott, general counsel for the medical association, recalled his surprise upon seeing the original NRA-backed legislation, which would have made it a felony for doctors to ask patients about gun ownership, punishable by jail time and a fine of up to $5 million. Scott brought a copy to show one of the physician group’s most loyal supporters in the House, a doctor, asking, “Can you believe this?”

“Yeah, I’m going to vote for it,” said the lawmaker, Paige Kreegel, a Republican from southwest Florida, according to both men. “Looking around here, I don’t see anybody who wants to cross the NRA.”

Scott then decided to enter into negotiations with Hammer, persuading her and her allies in the legislature to eliminate the criminal provisions and add language allowing doctors to discuss guns with their patients if they deem it medically necessary.

“If it was most other organizations, we would have gone to the mat and refused to compromise,” Scott said.

National medical groups were appalled even by the scaled-back version and challenged the compromise in court. A federal judge this year declared the law unconstitutional and blocked it. But the ruling was appealed by the state and is under review.

Wisconsin, long a holdout in the move toward looser gun laws, has become a focus for activists on both sides of the debate. With the help of a newly empowered Republican Party and centrist Democratic legislators, the NRA has begun to score major wins there, including a 2011 right-to-carry law that gun-control advocates consider one of the nation’s more permissive such laws because it made obtaining a permit so easy.

Prominent Democrats in the state, who had long fought the NRA on the concealed-carry initiative, marveled at the group’s ability to apply pressure.

“They can produce a small army for Election Day, and every elected official knows it,” said Rep. Mark Pocan, a newly elected Democratic congressman, who was a state legislator when the tide turned in Wisconsin.

The NRA’s newfound clout in Wisconsin has seldom been more apparent than it was last week when an effort to ban loaded guns in the public gallery collapsed. The issue arose as GOP lawmakers sought to ensure order in the Capitol, after raucous protests in 2011 over collective bargaining, by barring cellphones, notebooks, laptops and a variety of other items in the gallery.

State Rep. Leon Young (D-Milwaukee), a veteran of the Milwaukee Police Department, stood to call for an additional restriction — on loaded weapons. But Democrats backed away from the proposal out of concern that a roll call could become a key vote for the NRA — meaning the group would use the issue when deciding how to grade lawmakers on their report cards. A low grade could be politically fatal to Democrats from the state’s many rural districts.

The experience left Young pondering the prospects in Congress for Obama’s new gun-control proposals.

“Given my experience with the NRA in Wisconsin,” he said, “I’d advise the president to seek progress through executive order and not count on any action from the legislative branch.”

Sari Horwitz and Alice Crites contributed to this report.