Attorney General Jeff Sessions defended the FBI Friday, hours after President Donald Trump ripped the bureau's leadership and suggested that its reputation was "in tatters."

"I don't share the view that the FBI is not functioning at a high level all over the country," said Sessions, who added, "... In my view, the FBI has huge national security requirements but it's also fulfilling a fabulously important role working to fight against violent crime."

Sessions also praised Trump for speaking to graduates of a weeks-long FBI National Academy program for law enforcement leaders from around the country, calling it "the first time a president in 47 years has spoken to the FBI['s] ... graduating police academy class."

"He made clear that he supports them 100 percent in their activities and that we are going to be a law enforcement administration that helps the law enforcement be successful," said Sessions.

As Trump departed the White House for the speech in Virginia, he said, "It's a shame what's happened with the FBI," an apparent reference to revelations that senior bureau officials exchanged anti-Trump and pro-Hillary Clinton text messages while working on last year's Clinton probe and during special counsel Robert Mueller's investigation into whether Trump associates colluded with Russian officials in the 2016 election.

"We're going to rebuild the FBI, it'll be bigger and better than ever," Trump went on, "but it is very sad when you look at those documents, and how they've done that is really, really disgraceful, and you have a lot of very angry people that are seeing it."

Also Friday, White House Deputy press secretary Hogan Gidley told Fox News that edits to former FBI Director James Comey's statement on Clinton's private email server and anti-Trump texts from a top agent were "deeply troubling."

"There is extreme bias against this president with high-up members of the team there at the FBI who were investigating Hillary Clinton at the time," Gidley charged, as Mueller pushes on with a probe of possible Trump campaign ties to Russia. Gidley says Trump maintains confidence in the FBI's rank-and-file.

Sessions had previously drawn the wrath of Trump for recusing himself from overseeing Mueller's investigation over questions about his own contacts with Russia's ambassador to the U.S.

The Associated Press contributed to this report.