WASHINGTON, District of Columbia (AFP) - He took the reins of the FBI a week before the attacks of Sept 11, 2001. Twelve years later, Mr Robert Mueller is retiring, convinced that "the threat is still here."
Shortly before passing the baton to his successor James Comey on September 4 - a dozen years to the day since becoming director - Mr Mueller spoke to several media outlets, including AFP.
Under his leadership, the United States (US) Federal Bureau of Investigation has evolved considerably, from an agency probing past attacks to one whose "number one priority" was to prevent them.
"When I came on board, I had been a prosecutor for a number of years, spending time on those kinds of cases - organised crime, narcotics cases, white-collar cases and the like," recalled the lanky 69-year-old.
"I had in my own mind some ideas where the Bureau needed to go - and a week later we had September 11." "I did not expect that I'd be spending my time preventing terrorist attacks," he added.
During the upheaval of the US security apparatus that followed, the FBI saw its prime focus turn to anti-terrorism.
At the time, 2,000 out of 11,000 special agents were immediately transferred from fighting crime to combatting Al-Qaeda. Since then, the number of intelligence analysts at the FBI has more than tripled.
Over time, the danger posed by Al-Qaeda and its affiliates has evolved but, together with cyber threats, will remain "our number one priority for the foreseeable future."
While Al-Qaeda "was badly diminished, decimated," there was growth in other satellites after 2001 - including the Somali Islamist group Shebab and Al-Qaeda in the Arabian Peninsula (AQAP) in Yemen, Mr Mueller said.
One of Mr Mueller's many accomplishments was the foiling of an attack - planned by AQAP - on a commercial airliner bound for Detroit on Christmas Day 2009.
Mr Mueller expressed concern about the "shifting landscape in terms of the countries involved in the Arab Spring - Tunisia, Libya, Mali, to a lesser extent Algeria, Syria and, quite obviously in the last two months, Egypt."
"Every one of these countries has individuals who you would put in the category of violent extremists that present threats down the road, not just to the US but to Americans overseas," he said.
Mr Mueller also expressed concern about the threat posed by so-called "lone wolf" attackers who often become radicalised and learn how to make bombs online.
"Lone wolf or solo terrorists are much more difficult for us to identify and to disrupt for an attack to take place," he said.
"It's hard to quantify (the threat) because you have one metric and that is preventing all attacks. If there's one attack, you're unsuccessful."
In reference to the fatal shooting at the Fort Hood army base in 2009 and the Boston Marathon bombings on April 15, Mr Mueller said: "It's part of a pattern we've seen recently but a pattern that probably will be replicated in the future."
Major Nidal Hasan, a US army psychiatrist, is on trial for the Fort Hood rampage and has confessed to shooting dead 13 people. The marathon bombing, meanwhile, is believed to have been carried out by two brothers of Chechen origin, Dzhokhar and Tamerlan Tsarnaev.
The existence of "lone wolves" is why telephone and Internet surveillance programs are "tremendously important," Mr Mueller explained.
The National Security Agency (NSA) charged with collecting such data has come under scrutiny in the wake of recent revelations by former NSA contractor Edward Snowden about the scope of collection programs.
"There have been occasions - very few, I might say - when there have had to be some adjustments," Mr Mueller said.
"But I am fairly confident we are doing things the way the American people wants us to, with an appreciation on the potential impact on privacy and civil liberties."
In 2004, Mr Mueller threatened to resign over a warrantless wiretapping program under the administration of George W. Bush.
In the end, he was in the top FBI post for the second longest period after J. Edgar Hoover, who held it for 48 years until his death.