WASHINGTON — President Trump acknowledged publicly for the first time on Friday that he was under investigation in the expanding inquiry into Russian influence in the election, and he appeared to attack the integrity of the Justice Department official in charge of leading it.

In an early-morning tweet, the president declared that he was “being investigated” for his decision to fire James B. Comey, the former F.B.I. director. And he seemed to accuse Rod J. Rosenstein, the deputy attorney general, of leading a “witch hunt.”

The Run-Up

The podcast that makes sense of the most delirious stretch of the 2016 campaign.

The tweet was the first explicit concession by the president that Robert S. Mueller III, the special counsel for the Russia inquiry, had begun examining whether Mr. Trump’s firing of Mr. Comey last month was an attempt to obstruct the investigation.

And Mr. Trump’s apparent reference to Mr. Rosenstein, who oversees the Russia investigation because Attorney General Jeff Sessions recused himself from it, came just hours after an oddly worded statement from Mr. Rosenstein complaining about leaks in the case.

In the statement, Mr. Rosenstein wrote that “Americans should exercise caution before accepting as true any stories attributed to anonymous ‘officials,’ particularly when they do not identify the country — let alone the branch or agency of government — with which the alleged sources supposedly are affiliated.”

He added: “Americans should be skeptical about anonymous allegations. The Department of Justice has a long-established policy to neither confirm nor deny such allegations.”

Mr. Rosenstein’s statement followed two articles by The Washington Post that cited unnamed officials, one saying that Mr. Mueller’s investigation had widened to include whether Mr. Trump committed obstruction of justice, the other that it was looking at financial transactions involving Jared Kushner, the president’s adviser and son-in-law. After the statement, The Post updated the Kushner story so that its first sourcing reference was to “U.S. officials.”

The highly unusual statement by the deputy attorney general raised the question of whether Mr. Trump or some other White House official had asked him to publicly discredit the reports. Part of the revelations surrounding the Russia investigation and the firing of Mr. Comey has been that Mr. Trump repeatedly pushed top intelligence officials to say in public that Mr. Trump was not personally under investigation and that there was no evidence of collusion between his campaign and Russia in its interference in the 2016 election.

But there was some evidence that Mr. Rosenstein’s motivation may instead have been his own mounting frustration at seeing details of the law enforcement investigation appear nearly daily in the news media.

A Justice Department official, speaking on condition of anonymity to discuss internal matters, said that no one had asked Mr. Rosenstein to make the statement and that he acted on his own.

Still, the statement, followed by Mr. Trump’s tweet demonstrated the pressure on the deputy attorney general.

Earlier this week, a friend of Mr. Trump’s said the president was considering firing Mr. Mueller — a task that would be complicated by Justice Department regulations, which say that only the attorney general may fire a special counsel and only if there is good cause. Mr. Rosenstein is acting as the attorney general in the inquiry because Attorney General Jeff Sessions recused himself from investigations that touch on the 2016 presidential campaigns.

According to people briefed on his thinking, while Mr. Trump has left open the possibility of dismissing Mr. Mueller, his anger has been mostly trained on Mr. Sessions and Mr. Rosenstein. The president blames Mr. Rosenstein for appointing Mr. Mueller in the first place, and he faults Mr. Session for his earlier recusal from Russia-related issues.

But the people briefed on the president’s thinking said Mr. Trump also knows that firing Mr. Rosenstein would be politically dangerous.

In testimony before Congress on Tuesday, Mr. Rosenstein vowed to “defend the integrity” of the special counsel investigation, including by refusing any order to fire Mr. Mueller without justification. So far, he said, Mr. Mueller had done nothing to warrant removal.

Separately, the apparent expansion of Mr. Mueller’s investigation into whether Mr. Trump obstructed justice, including by firing Mr. Comey, has raised the question of whether Mr. Rosenstein, as a witness to and participant in the events in 2017 that culminated in that ouster, may have to also recuse himself.

If Mr. Rosenstein recuses himself from overseeing the special counsel investigation or were to resign or be fired by Mr. Trump — acting attorney general duties for the inquiry would fall to the department’s number-three official, Associate Attorney General Rachel Brand.

Ms. Brand has never served as a prosecutor. She advised the Bush Justice Department on selecting judicial nominees, and she served as a Republican appointee on the Privacy and Civil Liberties Oversight Board.

A Justice Department spokesman said Friday that Mr. Rosenstein’s thinking regarding a possible recusal had not changed in recent weeks and that he was still overseeing the Russia inquiry. Mr. Rosenstein told The Associated Press in an interview and testified before Congress this month that he would recuse himself from the investigation should the need arise, which he said he had also told the special counsel.

On Friday morning, Mr. Rosenstein made a public appearance at the Justice Department, presenting awards to dozens of department employees. He did not take questions from reporters.

In testimony on Tuesday, Mr. Rosenstein said that he has seen no reason to remove Mr. Mueller, whom he appointed last month.

The president’s latest tweet came after a series of others in which Mr. Trump continued to complain about the Russia investigations swirling around him, and just hours after members of Congress from both parties gathered at a baseball field to call for unity after the shooting at a Republican baseball practice this week.

In two other early-morning tweets, the president insisted that no one has found any “proof” that he colluded with Russians to meddle with the 2016 presidential elections, and he once again assailed the news media.

Mr. Trump’s claim to have 100 million social media followers is an exaggeration based on adding his followers on Twitter, Facebook and Instagram — many of whom are most likely the same people.

But however many people actually follow him on social media, the president clearly views them as a refuge from the barrage of newspaper headlines and cable news stories about the Russia investigations.

Faced with a Russia investigation that appears to be broadening, Mr. Trump appears eager to use Twitter to undermine the credibility of the inquiry and to convince his supporters that they do not need to worry.

In a third tweet Friday morning, Mr. Trump repeated his assertion that the investigations are a “phony Witch Hunt” and bragged that the nation’s economy was improving quickly.