On the infrequent occasions that Republicans enjoy electoral success in Massachusetts, it's usually because a candidate can convince voters that he or she isn't too closely aligned with the national GOP.

Gabriel Gomez, the Republican nominee in the June 25 special election for the U.S. Senate, is trying such an approach in his campaign against longtime Democratic U.S. Rep. Edward Markey. Gomez, a businessman and former Navy SEAL, has cast himself as a moderate Washington outsider beholden neither to his party nor special interests.

"It's the typical playbook of the Democratic Party, no matter who they are running against, to paint you with the national party," the political newcomer said during a recent campaign appearance before a small, mostly receptive audience at a local chamber of commerce event.

He then rattled off a list of positions that sets him apart from many conservative Republicans. He accused the National Rifle Association of being "dishonest." He called himself a "green Republican" who believes human activity contributes to climate change. On a number of issues, he said he agrees with Democratic President Barack Obama, including on a proposed change in how the government measures inflation for the purpose of adjusting Social Security benefits.

In explaining why he supports gay marriage, Gomez told the story of a friend and classmate at the U.S. Naval Academy who, despite being one of the highest achievers in the class, was dismissed just before graduation after telling a commanding officer he was gay.

If elected to the Senate, Gomez promised to support a bipartisan immigration reform bill that provides a path to citizenship for some young people living illegally in the country. He also backs wider background checks for gun sales that were included in a bill that recently failed to advance after winning the votes of only four Republican senators.

"The NRA, I think, was dishonest in how they presented that to persuade some senators to vote on that," he said.

It's Markey, Gomez suggests, who should be criticized for being in lockstep with his party during his 36 years in Congress.

Gomez is hardly the first Massachusetts Republican to try to put some distance between the national party, with mixed results.

Scott Brown scored an upset victory in the 2010 special election to succeed the late U.S. Sen. Edward Kennedy largely by appealing to the state's large block of moderate independents. But Brown lost his re-election bid to Democrat Elizabeth Warren last year despite casting himself as one of the Senate's most bipartisan members.

In 2002, Mitt Romney joined a string of Republican governors to win that office on a fiscally conservative, socially moderate platform, though he'd later veer to the right in his bid for the White House.

"I don't blame (Gomez) trying to distance himself from his party," said John Walsh, chairman of the state Democratic Party. "Because, in Massachusetts at least, the policies of the Republican Party are not supported. In fact, they are roundly rejected."

Walsh cites several issues in which he believes Gomez is aligned with national Republicans, including his opposition to a federal assault weapons ban and his position on abortion.

Gomez has described himself as "pro-life" by his Catholic faith though uninterested in changing abortion access laws. But Walsh notes Gomez's refusal to say how he might vote on specific abortion-related issues such as whether employers can cite moral grounds to deny coverage for birth control or other services.

"He's trying to find some fuzzy space so he can pretend he's not like other Republicans in Washington," Walsh said.

The challenge Gomez faces in winning over large numbers of moderate voters was on display during the question-and-answer portion of the chamber event in Newton, a heavily Democratic Boston suburb.

Ken Jaffe, a businessman from Natick, told Gomez he was an independent who votes for Democrats about "80 percent" of the time. He then pressed the Republican on why he won't go further on gun control by supporting a reinstatement of the assault weapons ban.

Gomez responded by citing his support for Second Amendment rights and claimed the ban from 1994-2004 failed to reduce gun violence.

But Jaffe was unconvinced.

"There is absolutely no reason in the world why anybody in this country should be selling assault rifles," Jaffe said after the event.

"He's not going to be able to win anything in this state as long as he takes this stance," Jaffe added, though he wouldn't rule out the possibility of voting for Gomez in the special election.

Gomez acknowledged many instances in which he supports the national GOP platform while saying he's "happy" to disagree on others.