BOSTON (AP) — Republican Jay McMahon has won his party's nomination to challenge Massachusetts Democratic Attorney General Maura Healey in November.

The attorney from Cape Cod defeated lawyer Dan Shores in Tuesday's GOP primary.

Healey is seeking her second term as attorney general and was unopposed in the Democratic primary.

McMahon won the endorsement of delegates to the Republican state convention in April. He says fighting the opioid epidemic will be his top priority.

McMahon also promises to be a "Second Amendment advocate" for gun owners.

Many gun rights activists criticized Healey over her office's enforcement of a ban on copycat versions of assault weapons.