The deadly shooting in ­Colorado has thrust the debate about gun control into the Massachusetts Senate race ­between Senator Scott Brown and Elizabeth Warren, exposing areas of deep division and some surprising agreement ­between the Republican and Democratic candidates.

Warren’s positions are largely in line with those of gun-control advocates, while Brown had long been endorsed by gun rights groups until he recently broke rank on a high-profile issue.

The candidates are most sharply divided about whether to renew the federal assault weapons ban, with Warren supporting an extension of the ban that expired in 2004 and Brown saying it is an issue best left to the states.

Gun control advocates have seized on the Colorado shooting to make their case for renew­al of the law that bans 19 types of semiautomatic guns, in part because accused gunman James Holmes allegedly used a semiautomatic weapon known as the AR-15 in the movie theater shooting that killed 12 people and wounded 58 more. Holmes purchased the gun legally, but it would have been banned under the expired assault weapons law.

But gun rights proponents argue that tight controls prohibit would-be victims from defend­ing themselves from attack­ers, who will acquire guns whether they are legal or not.

Brown, who has tried to walk a difficult middle ground on the issue, takes a different tack.

“Scott Brown supports the state assault weapon ban here in Massachusetts and believes that states are the appropriate venue for making these types of decisions,” Brown’s spokeswoman, Marcie Kinzel, said in a statement.

But Kinzel declined to answer several other questions about Brown’s gun control positions, including whether he supports gun control advocates’ proposals to require more rigorous background screenings for gun licenses, and whether he favored an NRA-backed amendment that limits the sharing of firearm trace information between law enforcement agencies.

Proponents of that measure say it protects gun owners’ privacy by preventing the Bureau of Alcohol, Tobacco, and Firearms from releasing information from its firearms database, except during a criminal investigation. Opponents say police could do more to crack down on illegal gun trafficking if the database had fewer restrictions on its use.

Warren’s campaign said she favors an extension of the ­assault weapons ban, supports proposals to require more rigorous background screenings, including for people who purchase firearms at gun shows; and opposes limits on the sharing of firearms trace information.

“There is a huge difference between the guns of a sportsman or homeowner and high-powered assault weapons with 100-cartridge magazines,” she said. “I grew up around guns and gun owners, and I will work to protect the rights of law-abiding citizens. But the law must reflect the reality that, in the wrong hands, guns can be used for violent crimes, disrupting communities and making families and neighborhoods less safe.”

In January 2011, following an Arizona shooting that killed six people and injured US Representative Gabrielle Giffords, Brown offered more pointed opposition to federal gun restric­tions, saying he was “not in favor of doing any additional federal regulations with regard to any type of weapons or federal gun changes.’’

While Warren has only recent­ly voiced her positions on gun rights, Brown has a 12-year record in the Massachusetts House and Senate, in addition to his 2½ years in the US Senate.

In the Legislature, Brown was a reliable vote for gun rights, with one major exception. He supported the state version of an assault weapons ban. But several of his votes earned top marks from gun rights groups, including an A-plus in 2008 from the Gun Owners’ Action League. Among them was a vote against a 2004 measure that sought to ban ­assault weapons manufactured prior to 1994. While serving as a state representative in 2002, he sided with a number of Democrats in allowing residents who had certain felony convictions to get gun licenses after seven years.

But last year, Brown broke with The National Rifle Association, which supported him in the 2010 special election with $59,000 in contributions, to ­oppose a bill that has been the gun rights lobby’s top priority in Washington.

Known as the National Right-to-Carry Reciprocity Act, it would allow gun owners with permits from their own states to carry concealed weapons across state lines, regardless of local and state restrictions. Brown said he would vote against granting that permission. Warren, too, opposes the measure.

In announcing his position in November, Brown said in a letter to Boston Mayor Thomas M. Menino, who had been lobbying against the measure, that he continued to support “the ­individual right to keep and bear arms,’’ but said that states should be able “to decide what constitutes safe and responsible gun ownership, so long as it does not violate that basic constitutional right.’’

Brown’s nuanced position has drawn criticism from both sides and has caused gun rights groups to cool in their support of him. “It certainly kept us out of getting involved in that race,” said Erich Pratt, director of communications for Gun Owners of America, a national group that will not support Brown.

Pratt said he does not see supporting Warren as an option either, so “we’re just going to put our resources elsewhere, behind people who are solidly behind the Second Amendment.”

The NRA said in a statement that it is not commenting on political and policy issues in the aftermath of the Colorado shooting.

Gun control advocates are equally suspicious of Brown. “This is not an issue I think he necessarily has a principled stand on,” said Ladd Everitt, ­director of communications for the Coalition to Stop Gun Violence, a group in Washington supporting gun control.

Everitt said Brown deserved praise for opposing the Reciprocity Act, but added that it was a “politically convenient” way for him to brandish his moderate credentials after Warren, a more forceful proponent of gun control, entered the race.

“That’s why with him it’s a mixed bag,” Everitt said.

John Rosenthal, founder of the Massachusetts-based Stop Handgun Violence, is especially frustrated with Brown.

“Scott Brown is absolutely part of the problem,” Rosenthal said. “It’s beyond me how he could think that it’s OK for Al Qaeda and domestic criminals to buy assault weapons and high-capacity ammunition clips, cash and carry, in 33 states.”

Noah Bierman can be reached at nbierman@globe.com. Follow him on Twitter @noahbierman.