Nine-term incumbent U.S. Rep. John Tierney on Tuesday conceded defeat to political newcomer Seth Moulton in the Democratic primary in the state’s 6th Congressional District.

Tierney would be the first sitting Massachusetts congressman to lose a primary since 1992, when former U.S. Rep. Marty Meehan beat then-incumbent Chester Atkins in the Democratic primary.

Moulton, a former Marine and Iraq war veteran from Salem, would face Republican Richard Tisei in the November election. He ran a well-financed campaign in his bid to unseat Tierney and suggested the incumbent had been ineffective in Congress. By mid-August, Moulton had raised $1.6 million compared with the $1.9 million raised by Tierney.

During much of the primary Tierney had focused his attention on Tisei.

Then, late in the primary, Tierney launched a campaign ad linking Moulton to Republicans who support gun rights and oppose abortion rights. The ad focused on money the Moulton campaign received from the White Mountain PAC, which is affiliated with former U.S. Sen. Judd Gregg, a New Hampshire Republican.

Moulton said the ad showed that Tierney believed he was a serious challenger.

Moulton has argued he would have a stronger chance of holding off Tisei, a former state senator who lost to Tierney by less than 1 percent of the vote in the 2012 election. Tierney had responded by saying he had beaten Tisei.

Immigration attorney Marisa DeFranco and two other Democrats, John Gutta and John Patrick Devine, also were on the primary ballot.

It was the second tough campaign for Tierney. In 2012, he was dogged by questions about what he knew of an illegal offshore gambling ring involving his wife’s family.

Moulton, a 35-year-old businessman and Harvard graduate who enlisted in the Marines in 2001, described himself in a campaign ad as a “progressive Democrat who opposed the war in Iraq.”

“But I also was a Marine serving my country,” Moulton said. “So I went, led my platoon and always ate last after my men.”

During the campaign, Moulton expressed his opposition to another ground war in Iraq as President Barack Obama considers the nation’s options for fighting back against Islamic State militants.

Moulton also backs abortion and gay rights, tighter restrictions on gun ownership and comprehensive immigration reform. About 8 percent of the district’s population served in the military, and about 15 percent are age 64 or older.

During the primary, Moulton suggested that Tierney’s victory two years ago was due in part to the political coattails of Obama and consumer advocate Elizabeth Warren, who were on the ballot and helped draw Democrats to the polls. Warren won a U.S. Senate seat against Republican Scott Brown.

Tierney had rejected Moulton’s suggestion, arguing that he had the issues on his side.

The general election could be equally hard fought.

Republicans see the 6th Congressional District at their best chance to pick up a seat in Massachusetts.

Tisei has already been the beneficiary of a $350,000 ad buy from the conservative U.S. Chamber of Commerce earlier in the year. The 30-second ad, which ran on TV and online in May, portrayed Tisei as “an independent voice for Massachusetts.”

Join our Newsletter for the latest news right to your inbox