CASPER, Wyo. (AP) — A federal judge has dismissed a defamation lawsuit over online harassment filed against actor Alec Baldwin by the family of a Marine who was killed in Afghanistan, saying the Wyoming court did not have jurisdiction over the case.

An attorney for the family said the case would be refiled elsewhere, the Casper Star-Tribune reported Wednesday.

The sisters and widow of Lance Cpl. Rylee McCollum alleged Baldwin subjected them to online harassment after he posted and commented on a photo shared online by one of McCollum’s sisters, Roice McCollum, who had been in Washington during the Jan. 6, 2021 insurrection.

Baldwin had donated $5,000 to the family after learning of the death of Rylee McCollum in a bombing at the airport in Kabul in August 2021, just weeks before his daughter was born. Baldwin had contacted Roice McCollum via Instagram, according to the lawsuit.

In January 2022, Baldwin saw that Roice McCollum posted a nearly year-old picture of demonstrators from former President Donald Trump’s rally taken on the day Congress counted the Electoral College votes from the 2020 presidential election, the complaint stated.

Baldwin sent her a private message and confirmed she had organized the fundraiser for her brother, the lawsuit said. She responded that her participation in the protest was “perfectly legal,” according to court documents.

Baldwin told Roice McCollum he would share her photo with his 2.4 million Instagram followers and wrote: “Good luck,” according to the lawsuit.

Roice McCollum said in the lawsuit that she received hundreds of hateful messages in response to his post. Thecomplaint, which also names her sister Cheyenne McCollum and Rylee’s wife, Jiennah McCollum, as plaintiffs, sought $25 million in damages.

Baldwin asked for the case to be dismissed, saying he was expressing his political opinion, that he had not been in Wyoming and that claims by Cheyenne and Jiennah McCollum should be dismissed because he did not make any statements about them.

U.S. District Judge Nancy Freudenthal said Wednesday that the case could not be brought in Wyoming because Baldwin made the posts from New York and because they were not directed specifically at a Wyoming audience. Her decision did not address the veracity of the allegations in the complaint.

“We are pleased with this victory,” said Baldwin’s attorney Luke Nikas. “This is a significant step toward the complete dismissal of the lawsuit, which seeks to punish Mr. Baldwin for expressing his political opinion.”

Dennis Postiglione, an attorney for the McCollums, said that the case would probably be refiled in New York, where Baldwin lives, or in California, where he works.