The Maine Supreme Judicial Court ruled this week that Wade Hoover, who was sentenced to 40 years in federal prison for producing and possessing child pornography, is also subject to state charges in connection with sex assaults on two boys.

Hoover, through his attorney, had argued that he should not have to face state indictment on 13 counts of gross sexual assault, claiming it constituted double jeopardy. Double jeopardy bars “multiple punishments for the same offense,” according to the law court decision.

However, the Maine Supreme Judicial Court ruled Tuesday that the double jeopardy exception did not apply.

“Contrary to Hoover’s argument, there is no evidence of a ‘sham’ prosecution here, nor is there evidence that the state prosecutors acted merely as ‘tools’ of the federal prosecutors,” the justices wrote.

The decision means Hoover will be back in court in September in Kennebec County to face the gross sexual assault charges, according to District Attorney Maeghan Maloney.

In court documents, James’ attorney, Jamesa Drake, argued that the trial court’s order allowing the state charges should be reversed because Hoover’s alleged sexual assault on children “was the primary reason that (Hoover) received a consecutive 10-year prison sentence for the federal crime of possession of child pornography.” Hoover “has already been punished for that conduct and the state’s prosecution impermissibly threatens to place him in jeopardy twice,” Drake wrote.

Maloney, who handled the appeal for the state, wrote in an email Wednesday that she is pleased with the decision.

“I appreciate this decision for the opposite would have forced shorter investigations and a rush to indictment,” she wrote. “It is important for the state to be able to pursue charges of gross sexual assault even when the person has already pleaded guilty to production of child pornography. I argued that they are different crimes and the person needs to have both on his record.”

During arguments before the law court in June, Maloney said the victims’ mothers wanted her to pursue state charges.

“I meet regularly with the victims’ moms,” Maloney said. “What they want is gross sexual assault conviction, that what he did be a part of the record for the rest of his life, because it is such a heinous crime.”

At Hoover’s sentencing in federal court in 2013, Judge John A. Woodcock Jr. described his conduct as masochistic and sadistic.

“It is hard for me to find words to describe your conduct in this case, because your conduct is simply unspeakable,” Woodcock said. “You have not merely violated the law; you violated the most basic moral code in society. You preyed upon young boys when they were vulnerable.”

Hoover, 37, a 1995 graduate of Hall-Dale High School in Farmingdale, was owner and chief instructor at Koshowarrior’s Martial Arts and the United Martial Arts academies in Lewiston, where he taught children as young as age 3. He was living in Augusta and working as a veterans’ support coordinator at the National Alliance for Mental Illness Maine when he was arrested in October 2012 at his workplace on charges of possessing sexually explicit materials involving children.

Acting on a tip, members of the Maine State Police Computer Crimes Unit and the federal Immigration and Customs Enforcement agency went to Hoover’s office, seized his computer and found dozens of images of child pornography, some of which showed him abusing two boys.

Hoover told investigators earlier that year he had taken a pair of children who were students at his martial arts studio for two nights to a cabin in The Forks Plantation in Somerset County. There, he took pictures and video of himself sexually abusing one of the boys, an 11-year-old, whom Hoover also had given sleep medication.

Another video taken from Hoover’s computer showed Hoover and an unidentified man sexually assaulting another young boy, whom officials later said was from Augusta.

At the time of his arrest, Hoover was charged by the state with possession of sexually explicit materials depicting minors under age 12, but that state charge was dropped later in favor of federal charges with higher penalties.

In February 2013 in U.S. District Court in Bangor, Hoover pleaded guilty to the federal charges of filming himself sexually assaulting the boy at the cabin and using his employer’s Internet connection to distribute child pornography images.

Four months later, though, Hoover was indicted by a grand jury in Kennebec County on a dozen new state charges of gross sexual assault on a boy in Augusta between Dec. 11, 2008, and Feb. 13, 2010.