Britain's domestic spy service thinks the threat from Islamist terrorism has stopped growing but remains severe, with terrorists eager to acquire weapons of mass destruction, according to the first authorized history of the agency.

"The Defence of the Realm," by Cambridge University historian Christopher Andrew, was commissioned by the agency, MI5, to mark its 100th anniversary this year -- the first time a major intelligence agency has granted an outsider access to its secret files.

The 1,000-page volume, published Monday, describes an organization that fought Hitler with stunning success but struggled to combat Soviet espionage during the Cold War and initially failed to grasp the threat from Islamic extremism.

Andrew claims MI5 was "slow to see the coming menace of Islamist terrorism." The book says the agency's then-head, Stella Rimington, had never heard the name Al Qaeda until a meeting in Washington in 1996, during which MI5 representatives were "taken aback by the interest" in Osama bin Laden shown by the Americans.

That changed with the Sept. 11, 2001 attacks. Since then MI5 has foiled several major terrorist plots against Britain, including a plan to blow up trans-Atlantic airliners using liquid explosives, for which several British Muslims were sentenced to life in prison last month.

It failed to stop the July 7, 2005 London transit bombings, which killed 52 bus and subway passengers, and Andrew said Al Qaeda-inspired terrorists remain determined to kill even more people with chemical, biological or nuclear weapons.

"It is not a question of if, it is a question of when such weapons will be used," he said.

The book says that in 2000, MI5 -- without realizing it at the time -- foiled a plot by Al Qaeda to obtain biological weapons when it found samples and equipment in the luggage of a Pakistani microbiologist, Rauf Ahmad, who had attended a conference on pathogens in Britain. U.S. intelligence later revealed that Ahmad had been in touch with Al Qaeda's No. 2, Ayman al-Zawahiri.

The book quotes MI5 chief Jonathan Evans as saying that recent counterterrorism successes have had "a chilling effect on the enthusiasm of the plotters."

The book says MI5 now believed that "though a major Islamist terrorist attack would remain a serious danger for the foreseeable future, the observable threat had stopped increasing."

But, Andrew added, "it is too early to tell whether the 'chilling effect' is a short-term fluctuation or a long-term trend."

The book -- its title comes from MI5's Latin motto, "regnum defende," defend the realm -- traces MI5's growth from a staff of two people in 1909 to more than 3,000 today.

Andrew says its biggest success was during World War II, when MI5 captured most of the German spies in Britain and turned 25 of them into double agents. He said that without them, the D-Day invasion in 1944 would not have succeeded.

"It was, as Wellington said about Waterloo, 'a damned close-run thing.' If the deception of the Germans hadn't been as good as it was, I don't think it could have happened," Andrew said.

Andrew said his favorite discovery among 400,000 MI5 files was the revelation that on the eve of World War II the agency tried to warn Prime Minister Neville Chamberlain about the Nazi threat by informing him that Adolf Hitler regularly insulted him with a vulgar expletive. "The insult ... made a considerable impression on the prime minister," the book notes.

Andrew regards MI5's biggest failure as the inability for decades to expose the "Cambridge Five" -- highly placed British intelligence agents who were spying for the Soviet Union from the 1930s onwards.

The book, published in the United States Nov. 3, is part of MI5's gradual opening-up to public scrutiny. Until the early 90s, the government would not even confirm the agency's existence, but it now advertises for recruits in newspapers and is opening its older files to the public.

Former MI5 chief Stephen Lander, who commissioned the authorized history in 2002, said the book was intended as a way of "reaching out beyond the myths and misunderstandings" about Britain's spies.

The book paints a largely positive picture. Although British spies have recently been accused of complicity in the torture of terrorist suspects held abroad, Andrew says the vast majority of agents over the decades have rejected torture.

"Every time I have come across examples in the files ... it is stopped," he said.