SEATTLE — A federal judge on Thursday threw out a lawsuit challenging parts of Washington state’s new law expanding background checks on gun transfers, saying gun rights activists couldn’t challenge it because they aren’t being prosecuted for violating it.

U.S. District Judge Benjamin Settle in Tacoma ruled that opponents of the law didn’t have standing to challenge the parts of Initiative 594 that required background checks for noncommercial gun transfers. To challenge the law, the plaintiffs must show that they’ve been actually prosecuted or at immediate risk of being prosecuted, he said.

The fairness of that rule can be questioned, the judge said, but he had to follow it.

“Plaintiffs explicitly concede that they have no intention of violating I-594, Plaintiffs have failed to allege any specific warning or threat to initiate a prosecution, and Plaintiffs have failed to allege any history of past prosecution or enforcement of I-594,” Settle wrote. “Therefore … the Court concludes that Plaintiffs have failed to show a genuine or imminent threat of prosecution and lack standing to bring this challenge.”

I-594 passed with 59 percent of the vote in November. It created universal background checks for all sales, including those made online or at gun shows, as well as for transfers including many loans and gifts. The measure has exceptions for emergency gun transfers concerning personal safety, gifts between family members, antiques and loans for hunting.