LONDON - It's James Bond, with bureaucracy and cramped office space.

The first-ever official history of MI6 reveals Britain's foreign spy agency debated assassinating Nazi leaders, landed a spy wearing a wetsuit over his tux at a casino by the sea and experimented with exploding filing cabinets - but also wrangled with other government departments and had to make do on a shoestring budget.

The book tells a story of plots, paperwork, duplicity and derring-do that takes in fears of a Nazi anthrax attack, cross-dressing secret agents and worries about the safety of the prime minister's milk supply.

"The real James Bonds are more interesting than the fictional James Bond," said author Keith Jeffery, a historian at Queen's University Belfast, who had access to previously secret files in the MI6 archive.

They are, often, larger than life: figures such as Wilfred "Biffy" Dunderdale, a Russian-speaking MI6 agent in Paris between the world wars, whom Jeffery said had "a well-known penchant for pretty girls and fast cars. He was a friend of James Bond creator Ian Fleming, and a possible model for the suave secret agent. In old age he became "an incorrigible raconteur" who would claim to recognize his own exploits in the 007 stories.

There also is Dudley Clarke, an agent arrested in Madrid in 1941 "dressed, down to a brassiere, as a woman." The Spanish fascist authorities, confused about whether he was a spy or simply a cross-dresser, eventually released him. Jeffery says he "went on to have a brilliant career in deception."

The book tells the story of an agency founded in 1909 with a staff of one, Mansfield Cumming, who recorded his first day in his diary: "Went to the office and remained all day, but saw no one, nor was there anything to do there."

It quickly got more interesting, although Jeffery writes that for decades, MI6 "had to operate on a shoestring" and was perennially short of office space.

The book reveals its agents included well-loved authors W. Somerset Maugham, Graham Greene and Arthur Ransome, who spied in the Soviet Union and whose mistress was Leon Trotsky's secretary.

It recounts how MI6 spied actively on the U.S. during the 1930s before deciding "it was more productive to be friends with the United States than continue to treat it as an intelligence target."

The book deflates some cherished myths. MI6 agents do not have a "license to kill," although the agency compiled a list of possible Nazi assassination targets before the D-Day landings. It was judged that the plan was too risky and might spark bloody reprisals.

More happily for spy buffs, Q - the gadget-making super-scientist from the Bond films - is based on reality. After World War II, MI6 researchers worked on silent weapons, knockout tablets, safecracking tools and exploding filing cabinets that could destroy secret documents at short notice.

The book follows the publication last year of an official history of MI5, Britain's domestic intelligence service.

Jeffery said he struck a "Faustian pact" when he agreed to write the book. He could look at everything in the archives, but MI6 retained the power to censor what was published.

The book is published in Britain by Bloomsbury as "MI6." In the U.S., it is published by Penguin as "The Secret History of MI6."

'The Secret History of M16'

by Keith Jeffery, Penguin