By MICHAEL BALSAMO, Associated Press

WASHINGTON (AP) — The Justice Department says that President Donald Trump directed illegal payments to buy the silence of two women whose claims of extramarital affairs threatened his presidential campaign, the first time prosecutors have connected Trump to a federal crime.

In a court filing , prosecutors said former Trump lawyer and fixer Michael Cohen arranged the secret payments at the height of the 2016 campaign "in coordination with and at the direction of" Trump. Cohen has previously said Trump was involved in the hush-money scheme, but court documents filed ahead of Cohen's sentencing made clear prosecutors believe Cohen's claim.

The filing stopped short of accusing the president of committing a crime. Whether a president can be prosecuted while in office remains a matter of legal dispute.

But there's no ambiguity in Friday's filing that prosecutors believe Cohen's act was criminal and Trump was directly involved, a remarkable disclosure with potential political and legal ramifications for a president dogged by investigations. The payments are likely to become a target for House Democrats gearing up to investigate the president next year. It's unclear whether Trump faces legal jeopardy over his role.

Federal law requires that any payments made "for the purposes of influencing" an election must be reported in campaign finance disclosures. The court filing Friday makes clear that the payments were made to benefit Trump politically.

In August, Cohen pleaded guilty to eight criminal charges, including campaign finance violations, and detailed an illegal operation to stifle sex stories and distribute hush money to buy the silence of porn actress Stormy Daniels and former Playboy model Karen McDougal, who had both claimed they had affairs with Trump. Trump has denied having an affair.

Daniels, whose real name is Stephanie Clifford, was paid $130,000 as part of a nondisclosure agreement signed days before the 2016 election and is currently suing to dissolve that contract.

Trump denied in April that he knew anything about Cohen's payments to Daniels, though the explanations from the president and his attorney, Rudy Giuliani, have shifted multiple times since then.

Another attorney for the president, Jay Sekulow, did not immediately return a call for comment.

Trump, in a Saturday morning tweet, said: "AFTER TWO YEARS AND MILLIONS OF PAGES OF DOCUMENTS (and a cost of over $30,000,000), NO COLLUSION!

In August 2016, the National Enquirer's parent company reached a $150,000 deal to pay McDougal for her story of a 2006 affair, which it never published, a tabloid practice known as catch and kill. In 2015, the company's chairman met with Cohen and Trump and "offered help with negative stories" about Trump's relationships with women by buying the rights to the stories, prosecutors said.

After McDougal contacted the Enquirer, the chairman of its parent company, American Media Inc., contacted Cohen about the story. After Cohen promised the company would be reimbursed, the Enquirer paid McDougal $150,000, according to court documents.

An audio recording released by Cohen in July appeared to capture Trump and Cohen discussing buying the rights to McDougal's story from the Enquirer's parent company. Trump's lawyers have said the payments were never made.

Legal experts have said the issue of whether Trump violated the law would come down to whether Trump tried to influence the election and whether he knew it was legally improper.

Former Sen. John Edwards, who sought the Democratic presidential nomination in 2008, was indicted in 2011 in connection with payments made on his behalf by a wealthy campaign donor to keep Edwards' mistress quiet, which prosecutors argued amounted to illegal campaign contributions.

Edwards argued the payments were meant to keep his wife from learning about the affair — not to protect his campaign — and were therefore not political donations.

A jury acquitted the North Carolina Democrat of one charge and deadlocked on the rest in 2012. The Justice Department did not retry the case.