President Trump is confident that FBI Director Christopher A. Wray is the right man for the job of rooting out “deep state” corruption in the Justice Department, the White House said Tuesday.

White House press secretary Sarah Huckabee Sanders said that the president does not believe the entire Justice Department is under the sway of “deep state” bureaucrats opposed to the Trump administration. But she said some of the actions at the agency, such as the handling of Hillary Clinton email investigation, are “very disturbing” and need to be examined.

“Obviously he doesn’t believe the entire Justice Department is part of that,” said Mrs. Sanders. “One of the things the president has done is appoint Christopher Wray at the FBI because he wants to change the culture of that agency and he thinks he is the right person to do that.”

Earlier, Mr. Trump called for prosecution and possible jail time for former Secretary of State Hillary Clinton’s top aide, Huma Abedin, who mishandled classified emails and exposed government passwords to hackers.

He also scolded the “deep state” at the Justice Department with failing to act against Mrs. Clinton, Ms. Abedin, former FBI Director James B. Comey and others involved in the Clinton email scandal.

“Crooked Hillary Clinton’s top aid, Huma Abedin, has been accused of disregarding basic security protocols. She put Classified Passwords into the hands of foreign agents. Remember sailors pictures on submarine? Jail! Deep State Justice Dept must finally act? Also on Comey & others,” he tweeted.

Since before he took office, Mr. Trump has been a harsh critic of the Justice Department, which in May unleashed special counsel Robert Mueller to investigate allegations Trump campaign officials conspired with Russia to influence the election.

The Russia probe continues to hang over the Trump presidency.

Mr. Trump also has struggled against the so-called deep state, longtime bureaucrats burrowed into government who have their own agenda and have been blamed for some of the leaks to the news media that helped fuel the Russia probe.

Mr. Trump fired Mr. Comey in May, which led to the appointment of Mr. Mueller.

The president has accused Mr. Comey of giving preferential treatment to Mrs. Clinton when she was under investigation during the 2016 presidential race.

Mr. Comey drafted a letter clearing Mrs. Clinton, the 2016 Democratic presidential nominee, of any wrongdoing prior to the conclusion of the investigation of her extensive mishandling of classified material while exclusively using of a private email account and private email server during her entire four-year stint as secretary of state.

The State Department last week released emails Ms. Abedin forwarded to a private Yahoo email account and stored on the laptop computer of her then-husband, disgraced former Rep. Anthony Weiner, who is currently serving jail time for sexting an underage girl.

Some of the Abedin emails contained passwords to government systems that were sent before millions of Yahoo accounts were hacked, according to a report by the Daily Caller.

The State Department released the emails in response to a freedom of information lawsuit by the conservative watchdog group Judicial Watch.