PG Wodehouse was questioned by MI5 as a suspected collaborator for broadcasting from Berlin during the second world war. The creator of Jeeves protested that he was shocked and dismayed at the criticism his broadcasts had provoked in Britain.

How the cosy world of Bertie Wooster collided with harsh reality is revealed in MI5 files released today at the National Archives. "I thought that people, hearing the talks, would admire me for having kept cheerful under difficult conditions," he said in a statement for MI5 in 1944.

Wodehouse was living in France when war broke out. He was taken prisoner when Germany invaded and sent to an internment camp in the German town of Tost, Upper Silesia. He described how, "as he was playing in a cricket match" on 21 June 1941, he was told to pack his bags and was put on a train to Berlin.

He was put up at the city's Adlon hotel, and was paid to make a series of broadcasts, mainly for American listeners, describing his life as an internee. He claimed he was motivated by gratitude over letters sent by fans from the US.

The Wodehouse files are among a number released at the National Archives on people regarded by MI5 as potential "British renegades", including collaborators, stool pigeons and possible subversives.

After the Berlin broadcasts Wodehouse and his wife, Ethel, moved to Paris, where they stayed at German expense at the Bristol hotel. It was there that he was interrogated after the liberation of Paris.

He referred in his statement for MI5 to Wesley Stout, editor of the Saturday Evening Post, who had expressed concern about the impact of Wodehouse's Berlin broadcasts on serialisations that the paper intended to publish. Stout had said Britons resented what they regarded as Wodehouse's "callous attitude" towards England. "I cannot understand what you mean about callousness," replied Wodehouse, according the statement he gave to MI5.

He said he was simply reflecting the "flippant, cheerful attitude of all British prisoners. It was a point of honour with us not to whine."

Wodehouse had previously written: "If this is Upper Silesia, what on earth must Lower Silesia be like?"

The idea for the broadcasts came from Werner Plack, former member of staff at the German consulate in Los Angeles, who in 1940 returned to the German foreign office in Berlin. Wodehouse referred to Plack as "my Hollywood friend". Wodehouse said in his MI5 statement that he was "greatly shocked" to be told that John Amery, brother of the Tory MP Julian Amery and later executed for treason, had recommended him to the German secret services "as a person who might be useful as a propagandist".

Wodehouse said that, while interned at Tost, he completed his novel Joy in the Morning, and wrote Full Moon, Spring Fever, and Uncle Dynamite.

The writer told MI5: "I would like to conclude by saying that I never had any intention of assisting the enemy and that I have suffered a great deal of mental pain as the result of my action."

MI5 decided that the broadcasts were not pro-German and had been unlikely to assist the enemy, and decided against prosecution.

However, a memo of a 1946 meeting between an M15 officer and the then director of public prosecutions, Sir Theobald Mathew, reveals that his case was re-evaluated after the war. "The director said that he now takes the view that, if Wodehouse ever comes to this country, he should be prosecuted," the officer recorded.

Wodehouse moved to the US in 1945 and lived there until his death in 1975, aged 93.