A Roman Catholic priest and former adviser to the royal family of Monaco was federally charged Thursday in Philadelphia with amassing a trove of thousands of pornographic images of children while working at the royal palace.

Prosecutors say the Rev. William McCandless — a member of the Wilmington-based religious order Oblates of St. Francis De Sales — began collecting his stash of illicit photos and videos, including some depicting torture, while stationed in the tiny nation on the French Riviera and working as a confidant of Princess Charlene, the wife of Monaco’s royal sovereign Prince Albert II.

He continued to add to it after his transfer back to the United States in 2017 to a post at DeSales University in Lehigh County, they said.

McCandless’ attorney, John Waldron, denied the allegations Thursday and suggested that the case against his client had its genesis in a bit of palace intrigue.

“There were some things going on regarding some things he found out in Monaco relating to illegal activities that he found out about,” Waldron said, refusing to go into specifics. “The people that were performing those activities did not like the fact that he knew.”

Though Waldron maintained that McCandless continued to enjoy the “full support” of the princess, the royal court and his religious order, he said “the princess and others” at the palace agreed three years ago that it would be best for him leave his position there.

Beforethat relocation McCandless, 56, of Wilmington, had served as a parish priest at one of the few English-speaking churches in Monte Carlo, where his close personal relationship with Princess Charlene began.

Known as “Father Bill” in the country’s tabloid press, he became a fixture in coverage of the princess, who was said to have considered him one of her closest friends after her marriage to Prince Albert in 2011.

She named him to an official position on her staff and to the board of directors of her charitable foundation. He was reportedly among those at her bedside when she gave birth to the couple’s twins in 2014 and later attended their baptism along with the nation’s then-archbishop, Bernard Barsi.

Details of the case filed against him Thursday in federal court in Philadelphia were sparse.

His indictment makes no mention of his royal connections and only outlined the specific charges against him, which included counts of possession and transfer of child pornography, each of which carry a mandatory five-year prison term upon conviction.

Prosecutors made only fleeting references Thursday about what first drew their attention to McCandless during the priest’s initial court appearance before U.S. Magistrate Judge Henry S. Perkins.

“Once Monaco discovered that he had amassed this collection of thousands of images of child pornography including torture of very young children,” Assistant U.S. Attorney Sherri A. Stephan said, “he conducted internet searches for things like how to get “off the grid,” how to “disappear,” and how to erase items from “the cloud.”

Waldron, in an interview afterward, told a different story. He maintained that authorities in the country had conducted a full investigation of the child-pornography allegations and cleared McCandless.

“It was inconclusive relating to him,” he said. “There was a computer over there that didn’t even have a password and that was able to be accessed by anyone in the public. He was never charged in Monaco.”

Investigators in Monaco did not return requests for comment Thursday. Nor did the nation’s embassy in Washington, a spokesperson for the royal family, or the Princess Charlene of Monaco Foundation.

The charges unsealed Thursday did not mark the first time McCandless had been accused of misconduct.

In fact, his overseas assignment in 2010 was announced the same summer that his name surfaced in a civil lawsuit involving the Oblates and a clergy sex-abuse victim.

That victim, identified in court filings only as “John Doe,” alleged during a sworn deposition that McCandless once told him, while the two men were seminarians and working as counselors at an Oblate summer camp, that he had molested a 14-year-old French boy.

J. Michael Reck, the attorney representing that plaintiff, could not recall Thursday whether the order took steps to investigate that claim or details of the timing of McCandless’ transfer.

But shortly after the deposition, the clergy sex-abuse watchdog group Survivors Network of Those Abused by Priests issued a news release about the claim and held a news conference outside of the Salesianum School in Wilmington, the Catholic high school where McCandless had been stationed as principal shortly before. He had also previously worked for seven years as a chaplain at North Catholic High School in Philadelphia.

In court Thursday, prosecutors suggested McCandless’ transfer then and his more recent one after the discovery of child pornography were connected.

“Whenever an accusation has surfaced against him, he has been moved assignments by the Oblates,” said Stephan, the assistant U.S. attorney.

A lawyer for the order declined to comment on either the allegations against McCandless or the accusation that the Oblates had repeatedly transferred him to evade investigations.

But Waldron insisted that claim, too, was false. He maintained that the 2010 accusation against McCandless had also been probed by the order and determined to be “unfounded.”

Since his return to the United States in January 2017, McCandless was stationed for nine months as a counselor at the Wellness Center at DeSales University, an Oblate-affiliated school in Center Valley. He was fired from that position after Homeland Security Investigations agents raided his living quarters at the school as part of the investigation that resulted in Thursday’s indictment.

A university spokesperson declined to comment on his case.

Since his dismissal from the university post, McCandless has held the titles of provincial archivist and general coordinator for Salesian Education, according to the Oblates’ website.

He was ordered Thursday to surrender his passport, remain under house arrest, and to forgo contact with minors until his trial.

“McCandless’ alleged conduct here is extremely disturbing,” U.S. Attorney William M. McSwain said. “It occurred not just overseas but continued while he crossed international borders, purporting to do the work of the church. The innocent children in these images will have to deal with the impact of this alleged abuse for the rest of their lives.”