Barbara L’Italien often describes herself on the 3rd Congressional District campaign trail as not just an advocate for stronger gun control, but specifically as the “only candidate” in the field “who has fought the NRA and won.”

And L’Italien, a Democrat, does have a clear, years-long history as a legislator of supporting measures that the NRA and other gun-rights groups oppose. When she was a state representative in 2004, she voted for the Massachusetts ban on assault weapons. More recently, L’Italien co-sponsored the state’s “red flag” bill and voted for a ban on bump stocks.

But L’Italien’s record also includes stretches of apparent support from the gun-rights lobby. In 2010, she was graded an A by the NRA and an A+ by the Gun Owners Action League and received endorsements from both of them over her Republican challenger. She was graded well again in 2012 before her ratings plummeted four years later.

In an interview, L’Italien said she has consistently been a voice in favor of “common-sense gun legislation” and that she never sought the NRA’s endorsement. She believes the support in 2010 came in response to a single vote she cast a year earlier to reduce the cost of a firearm identification card.

“I’ve done everything within my power to work for common sense gun control,” L’Italien said. “I also understand that we have lawful gun owners that engage in hunting and sportsmanship. This has never been about them. It’s been about trying to bring a sense of safety and security to people and making sure that weapons of war are not in the hands of civilians.”

Gun control has not been a central topic in the 3rd District race. Other issues, such as the economy and the opioid epidemic, have seen more attention from likely voters in polls, and there is substantial agreement among candidates on policy. Seven of the 10 Democrats on the Sept. 4 primary ballot, including L’Italien, were designated Gun Sense Candidates based on their answers to a questionnaire by Moms Demand Action, a prominent gun-control advocacy group.

“We’re proud that Moms Demand Action volunteers have convinced candidates and voters around the country that this is an important issue to run and vote on,” said Molly Corbett, a spokesperson for the organization, in a statement. “We welcome working with lawmakers who have fought for gun safety for years, as well as those who have turned the corner more recently. It will take all of us to end this crisis.”

However, L’Italien is the only candidate in the race to have received explicit approval from groups that are essentially on opposite sides of the matter, underscoring the political complexities at play.

The old endorsements are not immediately visible online today. A version of GOAL’s House ratings archived on April 17, 2010, shows the organization giving L’Italien an A+ grade and its endorsement. The NRA has deleted many of its past grades in state and federal races, but according to a database made available by Everytown for Gun Safety, L’Italien received an A rating and an endorsement from the NRA’s People’s Victory Fund in 2010. L’Italien never received any campaign funding from either the NRA or GOAL, state records show.

Both of those groups selected L’Italien, seeking a fifth term as state representative that cycle, over her Republican challenger and eventual winner, Jim Lyons. In the following cycle, when L’Italien attempted to win back her seat from Lyons, she received an A grade from the NRA compared to a B for Lyons.

“Past grades are not always indicative of a candidate’s rating for the current election cycle,” said NRA spokesperson Lars Dalseide in a statement. “Our ratings are based on the totality of a candidate’s present-day positions, record and actions in support or in opposition of the Second Amendment. They are services provided to NRA members so that they can choose the candidate who is the best person to defend their constitutional rights.”

GOAL did not respond to a request for comment.

The NRA has long had a close relationship with Republicans, but earlier in the decade, it endorsed Democratic state legislative candidates more frequently than it does now, according to the database. In 2010, the same year it backed L’Italien, the NRA endorsed only 17 percent of Democratic candidates nationwide compared to 47 percent of Republicans. The group also backed only 15 percent of candidates from either party in Massachusetts races that year.

L’Italien attributed the support from gun-rights groups to her 2009 vote as vice chair of the Ways and Means Committee to reduce the cost of a firearm identification card from $100 to $40, something she said sportsmen and hunters in her district had requested.

By 2016, when L’Italien was running for the state Senate seat she currently holds, her backing from those groups had eroded. She received a D and no endorsement from the NRA and a 20 percent rating from GOAL.

L’Italien said she believes the change came in the wake of the December 2012 mass shooting at Sandy Hook Elementary School in Newtown, Connecticut, which prompted Democrats to pursue gun-control policies more aggressively.

“The fact that you could vote to ban assault weapons back in 2004 and still get an endorsement from the NRA doesn’t mean that I’ve changed,” L’Italien said. “It only shows how extreme the NRA has become.”

In her current term as a state senator, L’Italien has taken several actions in favor of stricter gun control. She co-sponsored a “red flag” bill that limits the ability of high-risk individuals to access firearms, and helped pass a bill last year banning so-called “bump stocks” after a shooter reportedly used such a device to kill 59 people and injured 851 others at a Las Vegas concert.

L’Italien said she believes that record is enough to separate her from the field, despite whatever past favor she held in the eyes of gun-rights groups.

“This race is between a bunch of millionaires and rich kids who have never done anything to stand up to the NRA,” she said. “The other folks in this race have never had to stand up and take a tough vote. They’ve never had to go out and defend what they do.”

Follow Chris on Twitter @ChrisLisinski