After writing six historical novels in a row, with my latest novel Dominion I have fulfilled a long-held ambition and written an alternate history novel, a "what-if". I remember, as a history student in the 70s, reading Len Deighton's novel SS-GB, an alternate history in which Germany has successfully invaded Britain in 1940 and the country is divided between resisters and collaborators. Its imagining of a defeated Britain rife with spies stuck with me, and I became a fan of second world war alternate history novels, especially Robert Harris's Fatherland, which I think is the best.

Most such novels imagine a successful invasion of Britain, but my own reading convinced me that, militarily, Germany's planned 1940 invasion could not have succeeded, given Britain's control of the air and the sea. So I turned to another option, which very nearly happened – Neville Chamberlain being succeeded as prime minister in 1940 not by Winston Churchill but by fellow-appeaser Lord Halifax. Most of the Conservative Party, Chamberlain himself, and the King, wanted Halifax, not Churchill, to lead the proposed new coalition government, and the Labour Party left it to the Conservatives to decide. Halifax's doubts about his ability to be a war leader gave Churchill the post. If Halifax had assumed the position I think he would have made peace after Dunkirk; he certainly argued for doing so then. The terms would have been Britain keeping her empire and leaving Germany a free hand in Europe. I think, as Churchill did, that had this happened Britain would inevitably have ended up as a German satellite.

In Dominion, rigged elections have, by 1952, brought an increasingly authoritarian Britain run by Lord Beaverbrook and Oswald Mosley, while the growing strength – and violent actions – of the British Resistance, led by Churchill and Attlee, have led to the government allowing an expanded Special Branch and Auxiliary Police force to crack down ferociously on dissent, with the Gestapo in the background, while Germany increasingly presses Britain to deport its Jews for "resettlement in the East".

Dominion is a book about resisters and collaborators. The resisters are not all shining heroes. Nor are the collaborators all monsters. Some are motivated by fanatical nationalism, others are venal, but others are pacifists, while everyone fears threats not just to themselves but their families. The book's central character, David, is a civil servant secretly supplying information to the resistance. But he is full of conflict – over his part-Jewish background, which he has kept secret even from his wife Sarah, and over the dangers his activities could place her in. Sarah comes from a family of pacifists, some of whom are now collaborators, and the way she, and they, react to developing events is a major theme of the book.

David is sent on a dangerous mission and he and a group of fellow-resisters are pursued across a shabby, frightened Britain by a relentless Gestapo agent, Gunther Hoth. With Gunther I have tried showing something different to a stock Nazi, and he has some of the features of the classic modern detective – he is shambling and awkward, with a disastrous personal life, but also a brilliant and intrepid detective and hunter of – in his eyes – wrongdoers. He has an unshakeable moral compass. Unfortunately this is Nazism, and he is capable of its most appalling acts. But how a decent enough young German became a slave to Hitler's ideas is also part of the tale.

In writing my historical novels I have always tried to be as accurate as possible in conveying the world of the story. That is a hard task, but in Dominion there was the additional challenge that my 1950s never actually existed. I had to think through the developments I thought would have taken place in Britain after surrender – political, social, cultural. For example TV, which had just got started before the war closed it down, returns in 1940 not 1945, is more widespread and under increasing government control. There was no blitz, no Attlee government or welfare state. The world I have created is, I hope, recognisably the early 50s, but warped and twisted and impoverished, its worst aspects exaggerated.

In the wider world of the story America, after Britain's surrender, did a deal with the Japanese and retreated into isolation. All Europe is under Germany's heel, and with Britain gone from the field Hitler invaded Russia earlier and with more troops. However, unlike in some alternate history novels, the Third Reich is not triumphant. Hitler's Russian war has gone on for 11 years, sucking the resources of Germany and all Europe into the limitless territories of the Soviet Union. Hitler's Parkinson's Disease has left him a disabled recluse. Riven with internal conflict, the Nazi regime is on the edge of collapse. I always thought the whole Nazi enterprise was far more fragile than many think.

Why write this novel now? The main reason was that, having written four Tudor novels in a row I badly needed a break from Henry VIII's England. But also, during the last two years as I wrote the book, the evils of politics based on race and nationalism – its dominant theme – came to the fore again in Europe as economic crisis gripped the continent and many people responded, as they had in the 30s, by turning to nationalist solutions. I find the free-market ideology that has dominated the world for the past 30 years, and brought us to our present ruin, a dogma that has failed repeatedly and disastrously, but politics based on national identity is even more dangerous; anti-rational, demagogic, assuming individuals should be defined by their nationality, and, always, against an enemy.

Tragically, and unlike in the 1930s, nationalisms are on the rise in Britain as elsewhere in Europe, with Ukip and, north of the border, the Scottish National Party. In Dominion I have gone to town on the SNP's opposition to actively fighting fascism, which was also true in the real world. I make no apology for using the book to stress how I see the SNP, for all the moderate face it currently presents, as deeply dangerous, with no politics in the conventional sense, believing only in the old dream that the unleashing of "national spirit" and "national pride" can solve a country's problems.