The Justice Department appointed a special counsel Wednesday to investigate possible coordination between President Trump’s associates and Russian officials — a clear signal to the White House that federal investigators will aggressively pursue the matter despite the president’s insistence that there was no “collusion’’ with the Kremlin.

Robert S. Mueller III, a former prosecutor who served as the FBI director from 2001 to 2013, has agreed to take over the investigation as a special counsel, Deputy Attorney General Rod J. Rosenstein announced. The move marks a concession by the Trump administration to Democratic demands for the investigation to be run independently of the Justice Department. Calls for a special counsel intensified after Trump fired FBI Director James B. Comey last week.

[Everything you need to know about the Russia investigation’s ‘special counsel’]

“In my capacity as acting attorney general I determined that it is in the public interest for me to exercise my authority and appoint a special counsel to assume responsibility for this matter,’’ Rosenstein said in a statement. “My decision is not a finding that crimes have been committed or that any prosecution is warranted. I have made no such determination. What I have determined is that based upon the unique circumstances the public interest requires me to place this investigation under the authority of a person who exercises a degree of independence from the normal chain of command.”

Mueller, often described by those who worked for him as a stern and press-averse disciplinarian, issued a characteristically terse statement: “I accept this responsibility and will discharge it to the best of my ability.’’

(Victoria Walker,Jayne Orenstein,Dalton Bennett,Jenny Starrs/The Washington Post)

Trump reacted to the news by saying “a thorough investigation will confirm what we already know — there was no collusion between my campaign and any foreign entity. I look forward to this matter concluding quickly. In the meantime, I will never stop fighting for the people and the issues that matter most to the future of our country.”

In a series of tweets early Thursday, Trump decried that a special counsel was not named to investigate what he alleged were “illegal acts” by the Obama administration and the campaign of Hillary Clinton.

“With all of the illegal acts that took place in the Clinton campaign & Obama Administration, there was never a special councel appointed!,” Trump wrote, misspelling the word counsel.

Less than 15 minutes later, he tweeted: “This is the single greatest witch hunt of a politician in American history!”

The White House did not learn of Rosenstein’s decision until just 30 minutes before the public announcement was made. Rosenstein called White House Counsel Donald McGahn at 5:30 p.m. to inform him, at which point McGahn walked downstairs from his second-floor office to the Oval Office to notify Trump.

Trump summoned his senior staff to the Oval Office, and together they drafted a statement reacting to the decision, coming from the president, that was distributed to reporters shortly after 7 p.m.

One senior White House official who was present for the discussions described Trump as “unbelievably calm and measured.”

“I expected him to be ranting and raving, but he was like, ‘Fine, let them do what they have to do, but we’ll be focused on our agenda,’ ” said this official, who spoke on the condition of anonymity to describe the private talks.

Democrats cheered the announcement as a step forward in resolving the unanswered questions about Russian meddling in last year’s presidential election — and whether the president or anyone at the White House has interfered with the investigation.

[Here’s how an independent investigation into Trump and Russia would happen]

Sen. Richard Blumenthal (D-Conn.) said Mueller “has the expertise and experience, guts and backbone to uncover the truth.’’ He said Mueller must be given all the resources necessary to “pursue the facts wherever they lead,’’ including whether anyone may have tried to obstruct justice.

Rep. Jason Chaffetz (R-Utah), chairman of the House Oversight and Government Reform Committee, cheered the choice, writing on Twitter: “Impeccable credentials. Should be widely accepted.”

But some Democrats said Mueller’s appointment does not preclude the need for an independent commission to examine Russian interference in the election.

“An independent commission doesn’t govern the FBI investigation, an independent commission doesn’t make charging decisions,” said Rep. Adam B. Schiff (Calif.), the ranking Democrat on the House Intelligence Committee, which is conducting its own probe of Russian meddling. “The value an independent commission adds is you have a body that is truly independent of any political consideration. And also has all the resources it needs and a single focus on the oversight of what Russia did, how we need to respond in the future, and it brings that political independence and staff and resources on task. So those are two different needs, and I think they’re complementary, not in competition with each other.”

The special counsel law grants Mueller the authority to probe possible attempts to stymie his investigation.

The decision to appoint a special counsel comes a day after revelations that notes taken by Comey in February recount a conversation with the president in which Trump asked him to drop an investigation into his former national security adviser, Michael Flynn. Associates of Comey said he took detailed notes of multiple conversations with the president, and lawmakers are now demanding access to those memos and any other related records held at the FBI.

The decision also comes amid intense pressure on the senior official who has been overseeing the Russia probe, Rosenstein, to appoint a special counsel.

Rosenstein was put in charge of the Russia probe after Attorney General Jeff Sessions recused himself. Democrats have challenged Rosenstein’s impartiality in the Russia probe because he wrote a memorandum initially used as the rationale for Comey’s firing. In the memo, Rosenstein said Comey had violated long-standing Justice Department practices in his handling of the investigation into Clinton’s use of a private email server, but shortly after the announcement of the firing, the president said he had decided to fire Comey before he received the recommendation from Rosenstein.

Rosenstein is scheduled to brief the full Senate in a closed session on Thursday.

Former colleagues said Rosenstein’s move may help restore his battered reputation among current and former government lawyers. “He got absolutely pummeled by people that he knows,” said a former senior Obama administration lawyer, who spoke on the condition of anonymity to talk candidly. “I think this move, as so often happens in Washington, where there is the opportunity to wash away your sins, was a thorough scrubbing.”

Under the order signed Wednesday by Rosenstein, Mueller is tasked with investigating “any links and/or coordination between the Russian government and individuals associated with the campaign of President Donald Trump’’ as well as “any matters that arose or may arise directly from the investigation’’ and any other matters that fall under the scope of the Justice Department regulation covering special counsel appointments.

It wasn’t immediately clear from the language of the order where Mueller might draw the lines as to which matters are related to the Russia investigation.

That language seems to suggest that Mueller could also take over ongoing investigations into leaks of classified information connected to the Russia probe. As the FBI director, Mueller assiduously discouraged leaks by his subordinates and oversaw investigations that sought to criminally charge leakers of government secrets.

“If the special counsel believes it is necessary and appropriate, the special counsel is authorized to prosecute federal crimes arising from the investigation of these matters,’’ the order states.

Another potential legal complication could arise from the law firm where Mueller worked until his appointment as special counsel. That firm, WilmerHale, has represented Trump’s former campaign chairman Paul Manafort, who has been under investigation relating to his work and payments for advising Ukrainian government officials. Officials referred questions about possible recusals on those subjects to Mueller, who didn’t respond to requests for comment.

Officials said the appointment was being made under a Justice Department statute that has only been used once, in 1999, although the Justice Department has made other special counsel appointments more recently under different authority.

Peter Zeidenberg, who has worked for a past special counsel, called Mueller an “inspired choice’’ because he comes to the job with automatic credibility among both parties.

“He’s nominally a Republican, but he’s really not a political person at all,’’ said Zeidenberg, a lawyer now in private practice, who cautioned that such an investigation is likely to take a long time and may not ultimately satisfy the public’s demand for a full accounting. “People are waiting for public answers to what happened, but that’s not his job. There won’t be a report or a news conference at the end of this from him, that’s not his role.’’

When he was FBI director, Mueller worked closely for a time with Comey — who as deputy attorney general was nominally Mueller’s boss during the George W. Bush administration — and while the two men agree on much, they have very different personalities. Mueller was a harsh taskmaster who eschewed expressions of warmth with his staff. Comey, in contrast, has written holiday greetings to staff that have been described as moving.

The special counsel gets money and personnel from the Justice Department, but Mueller can ask for specific individuals to join the case. WilmerHale lawyers James Quarles and Aaron Zebley also stepped down from WilmerHale Wednesday, and a firm spokesman said they were expected to join Mueller. Zebley, a former FBI agent and assistant U.S. attorney, was Mueller’s chief of staff at the FBI. Quarles was an assistant special prosecutor on the Watergate Special Prosecution Force.

Given the extremely sensitive nature of the counterintelligence probe, it is likely that Mueller will also work with many of the current FBI agents assigned to the case, although the decision is ultimately his to make. The budget for the investigation will still have to be approved by Rosenstein.

In his new role, Mueller answers to, and in theory could be fired by, Rosenstein, but in practice a special counsel is not subject to daily supervision by any Justice Department official. And given that Mueller’s appointment came about largely because of the firing of the FBI director, it would probably touch off a new political firestorm if Mueller were ever dismissed.

Philip Rucker, Ellen Nakashima and Julie Tate contributed to this report.

Read more:

House majority leader to colleagues in 2016: ‘I think Putin pays’ Trump

The worst job in Washington right now: Working for Trump