BERKELEY HEIGHTS, N.J. — President Trump lashed out at his longtime lawyer, Michael D. Cohen, on Saturday, suggesting that there could be legal consequences for Mr. Cohen’s decision to record a discussion they had two months before the 2016 election about paying a former Playboy model who said she had an affair with Mr. Trump.
“Inconceivable that the government would break into a lawyer’s office (early in the morning) — almost unheard of,” Mr. Trump wrote on Twitter. “Even more inconceivable that a lawyer would tape a client — totally unheard of & perhaps illegal. The good news is that your favorite President did nothing wrong!”
With his tweet, Mr. Trump signaled open warfare on Mr. Cohen, a longtime fixer he had until now tried to keep by his side as the Justice Department investigates Mr. Cohen’s involvement in paying women to quash potentially damaging news coverage about Mr. Trump during the campaign.
In late April, Mr. Trump said on Twitter that “I have always liked & respected” Mr. Cohen, and that while “most people will flip if the Government” spares them punishment, “I don’t see Michael doing that.” But early this month, Mr. Cohen suggested that he was looking seriously at cooperating with prosecutors, telling ABC News that “I put family and country first.”
Mr. Trump’s advisers have viewed the Cohen investigation as possibly a greater risk to the president than the special counsel inquiry into his campaign’s ties to Russia, given Mr. Cohen’s onetime status as the keeper of Mr. Trump’s personal and business secrets.
While the president suggested that Mr. Cohen’s recording may have been illegal, New York law allows one party to a conversation to tape it without the other knowing. Over the years, Mr. Cohen, in his dealings on Mr. Trump’s behalf with journalists, opposing lawyers and business adversaries, frequently taped his conversations, unbeknown to the people with whom he was speaking. Mr. Trump himself also has a history of recording phone calls and conversations.
In going after his longtime associate, Mr. Trump, who left Washington on Friday to spend the weekend at his New Jersey golf course, added another chaotic twist to a head-spinning week that began with a widely condemned news conference with Vladimir V. Putin, the Russian president, in Helsinki, Finland.
The president’s aides, who spent the first part of the week frantically trying to figure out how to clean up the aftermath of the news conference, have had little to say about accusations by women that Mr. Trump’s lawyers had paid them for their silence in the wake of extramarital affairs.
The White House did not immediately respond to a request for comment on Saturday. But in the past, the president’s aides have called the account of the affair by the former model, Karen McDougal, “an old story that is just more fake news,” and have denied that the president was involved.
The recording is sure to raise new questions about what the president knew about the payments and when.
Ms. McDougal says she began a nearly yearlong affair with Mr. Trump in 2006, shortly after Mr. Trump’s wife, Melania, gave birth to their son Barron.
Ms. McDougal sold her story for $150,000 to The National Enquirer, which was supportive of Mr. Trump, during the final months of the presidential campaign. But the tabloid sat on the story, which kept it from becoming public. The practice, known as “catch and kill,” effectively silenced Ms. McDougal for the remainder of the campaign.
On the recording, Mr. Trump and Mr. Cohen were discussing what would essentially have been a reimbursement to American Media Inc., or A.M.I., the parent company of The Enquirer. The recording was found during an F.B.I. raid on Mr. Cohen’s office this year.
When The Wall Street Journal reported on A.M.I.’s payments to Ms. McDougal days before the election, the Trump campaign denied knowing about them. Hope Hicks, the campaign spokeswoman, said at the time that Ms. McDougal’s claim of an affair was “totally untrue.”
On his way to his golf club in Bedminster, the president ignored questions from reporters about why his campaign would have denied knowledge of the payments if he was on tape discussing them with Mr. Cohen.
Maggie Haberman contributed reporting from New York.