CONCORD, N.H. — New Hampshire’s gubernatorial candidates tangled over the state’s opioid crisis, immigration and other issues in televised debates a week ahead of their primaries.

Four Republicans were first to face off Tuesday night in a debate on WMUR-TV, followed by a separate debate for three Democrats.

The candidates are competing in the Sept. 13 primaries for a shot at replacing Democratic Gov. Maggie Hassan, who’s running for U.S. Senate.

Early in the Republican debate, state Sen. Jeanie Forrester defended her call to get the National Guard involved in combatting the drug crisis and criticized Manchester Mayor Ted Gatsas as uninformed on efforts already underway. In her closing remarks, she attacked each of her rivals in turn, saying Gatsas has “lost control of his city.” She accused Executive Councilor Chris Sununu of being “rolled over” by special interests, and dismissed state Rep. Frank Edelblut as “the guy at the end” who “has no plans for New Hampshire.”

Gatsas, meanwhile, criticized Sununu, saying his rhetoric on immigration and other issues doesn’t match his actions. Asked whether immigration is vital to the state’s economy and workforce, Sununu said electing a governor who understands business is more important and touted his opposition to President Barack Obama’s plan to bring 10,000 Syrian refugees to the United States. Gatsas then criticized Sununu for also voting against a plan to temporarily halt immigration to Manchester several years ago, but Sununu said that vote had nothing to do with Obama’s plan.

Edelblut took issue with the premise of the immigration question, saying New Hampshire should embrace its aging population, perhaps by becoming a leader in medical device manufacturing as a way to boost the workforce.

“The aging population is not a liability. It’s an asset and we need to treat it as such,” he said.

In contrast to Sununu’s political pedigree — his father was governor and his brother was a U.S. senator — Edelblut said being governor was not on his bucket list but he felt compelled to stand up for the citizens of the state. But Sununu said his campaign was as much inspired by his mother — who emphasized giving back to one’s community — as his father.

“It’s about public service it’s not about making a career about it,” he said.

There was less tension on the Democratic side, which featured former Portsmouth Mayor Steve Marchand, Executive Councilor Colin Van Ostern and Mark Connolly, former director of the state bureau of securities regulation.

In outlining his plan to address the opioid crisis, Marchand suggested his rivals aren’t willing to put their money where their mouths are.

“If you want things that matter, you have to pay for them,” he said. “You’re not going to hear much from them on the need for increased revenue.”

All three said they disagreed with Hassan’s call to freeze immigration of Syrian refugees to the state. And in contrast to the Republican debate, all called immigration key to the state’s economic growth. Asked whether the state should prevent so-called sanctuary cities, Van Ostern said the state should focus on making sure new immigrants can learn English, take civics classes and gain job skills.

“We should focus on what we can actually do right here in New Hampshire.”

The Democrats also were asked about gun control and how they reconcile such proposals with the fact that New Hampshire is home to a gun manufacturer. Connolly said he backs a ban on military-style assault weapons and that the company’s location had no bearing on his position.

“If Congress cannot act (on a ban), we should do it, and put aside the consideration about how it affects business,” he said.