While working as a journalist in the early 1970s Jan Guillou had been convicted of espionage for exposing an illegal secret spy organization inside the Swedish military (see the IB affair). During his prison sentence in 1974, he read the crime novels about Martin Beck, written by his friends and fellow left wing writers Per Wahlöö and Maj Sjöwall, and this inspired him to write his own political crime novels. But instead of writing about the police he would write about the world of intelligence and counter-intelligence from the viewpoint of a Swedish spy, making use of his vast research and journalistic experience in this field.
Guillou had published his debut novel "Om kriget kommer" (If the War Comes) in 1971, some years before the IB affair, where the main character is also an officer in the Swedish military intelligence. But he didn't begin writing on the new spy project until the mid-1980s, when a personal encounter with Norwegian security police in Oslo inspired him to the plot of the first novel. Many years after the IB affair, Guillou had also befriended the former chief of the Swedish military intelligence, who came to serve as a sounding board for the plot of the novels and be the inspiration for the character of the retired spy chief DG.