IT’S the top-secret agency that we only know about from movies and TV. When the small-town cops can’t handle it, call in the feds.

But in reality, the Federal Bureau of Investigation is a crucial intelligence and security service whose role has become even more important in post-9/11 America, given its focus on counter-terrorism.

Now, US President Donald Trump has launched an unprecedented attack on the bureau that current and former agents say will fundamentally damage its ability to keep Americans safe.

Mr Trump has long spouted the conspiracy theory that the “deep state” is out to get him. He argues that unelected figures within the FBI, Department of Justice and other government agencies have established shadowy networks designed to undermine his presidency.

On Friday, the President held up a four-page memo as proof of that conspiracy against him. According to the Republican-penned document, the top ranks of the FBI abused their powers by spying on a former Trump campaign staffer.

“I think it’s a disgrace what’s happening in this country,” Mr Trump said after he signed off on the memo’s release.

“A lot of people should be ashamed of themselves.”

But this is simply his latest in a long line of attacks on the integrity of the 110-year-old institution, which is meant to float above politics.

Mr Trump says the figures at the top of the FBI have a political bias against him, and this assault is taking its toll on the organisation’s reputation.

A poll published last week by news site Axios found that 28 per cent of voters had an unfavourable view of the bureau, including 47 per cent of Republicans who held an unfavourable opinion.

Mr Trump’s war has caused consternation within the ranks of the FBI, which employs 35,000 people. It’s even caused one FBI special agent to turn in his badge.

In an opinion piece in The New York Times, Josh Campbell said he was quitting because “the relentless attacks on the bureau undermine not just America’s premier law enforcement agency but also the nation’s security”.

“FBI agents are dogged people who do not care about the direction of political winds. But to succeed in their work, they need public backing. Scorched-earth attacks from politicians with partisan goals now threaten that support, raising corrosive doubts about the integrity of the FBI that could last for generations,” he wrote.

Former FBI agent Christopher Hunter said this scepticism towards FBI agents could be enough to see criminals walk free from court.

“All it takes to sink a case is for one juror to disbelieve the FBI,” he told the Times.

The White House argues, however, that Mr Trump has the utmost respect for the bureau’s rank-and-file agents. His beef is with those at the top.

Ultimately, the President’s war against the FBI comes down to one thing: Russia.

Former FBI director Robert Mueller is leading an investigation into whether the Trump campaign colluded with the Russian government to sway the 2016 presidential election. It’s a charge that infuriates Mr Trump. He says that there is no evidence of collusion and that the probe is a political witch-hunt designed to explain the Democrats’ humiliating loss.

Mr Trump took an extraordinary step in May and fired then FBI director James Comey over the Russia inquiry. The President’s termination letter to Mr Comey said that he had been fired on the advice of the Attorney-General because a new leader was needed to restore public confidence in the organisation. But Mr Trump offered a different explanation later that week, saying it was his idea to fire Mr Comey over the “made-up story” of Russian collusion.

While Mr Comey has become a figure of scorn for Trump loyalists, the irony is that he is equally reviled on the Democratic side. Hillary Clinton argues that Mr Comey cost her the election when he revealed days before the poll that the FBI had reopened the investigation into her hosting classified emails on a private server.

Mr Trump’s sacking of Mr Comey sent shockwaves through the bureau that still ripple today. Morale is low and staffers struggle with how to address the crisis in confidence.

“In some offices, you’d go in and it was just ‘Comey, Comey, Comey’ everywhere,” one law enforcement official told The Washington Post. “There’s still a lot of that, but not as much.”

Mr Trump doubled down on his FBI conspiracy theory last month when text messages exchanged by two bureau staffers briefly went missing.

The President said the disappearance of the texts between Russia counterintelligence agent Peter Strzok and his mistress, FBI lawyer Lisa Page, was “one of the biggest stories in a long time”.

Mr Strzok was removed as the lead investigator in the Russia probe in July when private texts he exchanged with Ms Page came to light that showed them calling Mr Trump an “idiot” and a “loathsome human”.

Republicans and Trump supporters said it was further proof of a bias against the President that stretched all the way to the top of the bureau.

(The missing texts were quickly recovered and are now being reviewed by Congress.)

Last week, the memo provided Mr Trump with his strongest line of attack yet. The document alleges that the FBI abused its power when it spied on a former Trump staffer, Carter Page, an American citizen who was suspected of acting as a foreign agent for Russia. The memo claims that approving the warrant to surveil Mr Page was illegitimate because it was largely based on a dossier of unverified claims funded by the Clinton campaign and the Democrats.

Mr Comey returned to the fray on Friday to suggest that the memo was not the smoking gun the Republicans had made out it was.

“That’s it?” he tweeted. “Dishonest and misleading memo wrecked the House intel committee, destroyed trust with Intelligence Community, damaged relationship with FISA court, and inexcusably exposed classified investigation of an American citizen. For what? DOJ FBI must keep doing their jobs.”

The President said the memo “totally vindicates” him in the probe, but Democrats say the document does not tell the whole story.

The party has its own memo that it is pushing to declassify, which reportedly shows that the FBI relied on much more information than the dossier to justify spying on Mr Page.

The controversy has put current FBI director Chris Wray in an uncomfortable position.

His apolitical role precludes him from launching a full-throated public defence of his agency, but he did send an internal message to his employees urging them to ignore the critics and get on with the job.

“Talk is cheap; the work you do is what will endure,” Mr Wray said in a video, according to NBC News.

“Remember: keep calm and tackle hard.

“Thank you for standing strong together, and for keeping your faith in this institution that means so much to all of us.”

Whether or not Mr Trump is correct in his assessment of the FBI, the damage is done. Whatever Mr Mueller’s probe ultimately finds, the President will argue the whole process was tainted from the start.