Seventy-five years ago, on 23 August 1939, Hitler's Germany and Stalin's Russia stunned the world by announcing that they had concluded a non-aggression pact, committing themselves not to aid each other's enemies or to engage in hostile acts against one another. Stalin knew the pact would not be popular. "For many years now," he said, "we have been pouring buckets of shit on each other's heads, and our propaganda boys could not do enough in that direction. And now, all of a sudden, are we to make our peoples believe that all is forgotten and forgiven? Things don't work that fast." Many western European communists, disgusted at this turn of events, left the party at this point in what was probably the largest exodus of members before the Soviet invasion of Hungary in 1956. The front garden of Nazi party headquarters in Munich was quickly filled with party badges and insignia thrown there by party members appalled at the thought of an alliance with the communist enemy they had spent their lives fighting against.

The shock would have been all the greater had people been aware of the secret clauses of the pact, with subsequent addenda, in which the two states agreed to partition Poland between them – Germany taking the larger part – while Hitler conceded that the independent Baltic states of Latvia, Lithuania and Estonia, Finland and parts of Romania would fall into the Soviet sphere of influence. Just over a week later, Hitler invaded Poland, his armies brushing aside the brave but ill-equipped Polish army, while shortly afterwards the Red Army marched into the eastern part of the country. In 1940, Stalin's troops marched into the Baltic states. His attack on Finland was initially repulsed in the "Winter War", but numbers told in the end, and an uneasy peace was reached, marked by Soviet annexations of Finnish territory in the east of the country. Further south, the Soviets seized Bessarabia and northern Bukovina from the Romanians.

These events are hardly "largely unknown", as Roger Moorhouse claims in his new book, nor are they "dismissed as a dubious anomaly" in the standard histories of the second world war. They were a crucial feature of the runup to the outbreak of the war, and they entered literature as part of George Orwell's Nineteen Eighty-Four, where a sudden switch of alliances causes the hero Winston Smith to work overtime as he carries out the task assigned to him of rewriting the newspapers to make it look as if the new alliance had always been in existence.

And alliance indeed it was. For Hitler, the pact provided a guarantee that he could invade first Poland, then France and most of the rest of western Europe, without having to worry about any threat from the east. For Stalin, it allowed a breathing space in which to build up armed forces that had been severely damaged by the purges of the previous years, as his botched invasion of Finland showed. It also gave him the chance to expand the Soviet Union to include parts of the old Russian empire of pre-revolutionary times. Moorhouse is right, therefore, to insist that for Stalin the pact was not merely defensive, though he goes too far when he claims it was a golden opportunity for the Soviet leader "to set the world-historical forces" of revolution in motion. After a decade of "socialism in one country", he was not going to do that.

The pact eventually extended to the economic sphere, with Germany providing military equipment in exchange for raw materials such as oil, grain, iron and phosphates. Moorhouse sensibly discounts claims that these made a decisive economic difference to Germany or provided the Soviet Union with a crucial military advantage, though the statistics he quotes of German arms and equipment reaching Soviet factories are impressive, and Soviet deliveries of oil to the fuel-starved Germans were not without their effect. Shockingly, Stalin also handed back a substantial number of German communists who had taken refuge in the Soviet Union after the Nazi seizure of power; some of them, arrested during the purges, were taken directly from the Soviet Gulag to a German concentration camp.

Moorhouse tells a good story and, though it has been told before, notably in Anthony Read and David Fisher's The Deadly Embrace (1988), he is able to add interesting new details. His account of the negotiation and signing of the pact, finalised by Ribbentrop and Molotov, two men who had become foreign ministers of their respective countries through fawning sycophancy towards their respective leaders, is masterly.

Yet for all its virtues this is a deeply problematic book. Page after page is devoted to a detailed description of the horrors inflicted by Stalin and his minions on the territories the pact allowed him to occupy, with mass arrests and deportatations, shootings, torture and expropriation. The shooting of thousands of Polish army officers by the Soviet secret police in Katyn Forest and elsewhere has been well known for decades, like the brutal deportation of over a million Poles to Siberia and Central Asia, but much of the material provided by Moorhouse on the Baltic states is relatively new and makes sobering reading.

None of this, however, is balanced by any comparable treatment of the atrocities committed by the Nazis in Poland following their occupation of the western part of the country: the expropriation of Polish farms and businesses, the mass confiscation and looting of private property, the deportation of more than a million young Poles to work as slaves in Germany, the brutal displacement of Polish populations, the massacres of Poles carried out by the Germans, and the confinement of the majority of Poland's 3 million Jews in overcrowded, insanitary and deadly ghettoes in the major cities in the Nazi zone, where they were dying in large numbers within a few months.

If the pact allowed Stalin to visit his murderous policies on the Baltic states, it also permitted Hitler to do the same with the much larger and more heavily populated countries he invaded in western Europe at the same time, and even more so in the areas of southern Europe he conquered early in 1941. Yet the expropriation of Jews, the mass deportation of Alsatian Jews to camps in France, the massacres and atrocities committed by the Germans and their allies in Yugoslavia and the starvation of Greece receive barely a mention in this book, although they happened while the pact was still in force. The unbalanced treatment extends even to the period after the pact ended, in June 1941: Moorhouse devotes considerable attention to the Soviet attempt to cover up the Katyn massacre, but fails to mention the deliberate killing of Red Army troops taken prisoner by the Germans.

The book ends by praising the European Day of Remembrance for the Victims of Stalinism and Nazism, instituted by the EU in 2009 at the behest of the Baltic states, and held every year on 23 August, the anniversary of the signing of the pact. It is written very much in the spirit of the founding declaration of this "Black Ribbon Day", whose 19 points focus almost exclusively on Soviet atrocities while sparing barely a thought for Nazi ones. This goes even further than merely equating the two regimes, as the declaration purports to do. In both the book and the declaration, Stalinism comes out as being far worse than nazism.

This reflects the post-communist mood in the Baltic states, where SS veterans are hailed as "freedom fighters" against the Russians and are allowed to parade unhindered through the streets of Tallinn. In this view, the war fought by the western allies against Nazi Germany was a gigantic mistake; all it achieved was the enslavement of eastern Europe under the Soviet yoke. Yet, in the end, brutal and murderous though Stalinism was, Nazism visited even greater horrors on humanity with its policies of the genocidal elimination of the "inferior" and the "Jewish world enemy". The Nazi "General Plan for the East", conceived already in 1940, envisaged the extermination of 85% of the population of Estonia and 50% of the populations of Latvia and Lithuania. The Red Army might not have liberated these countries in 1945, but it certainly rescued them. Readers of this thoroughly biased and one-sided account of the Nazi-Soviet pact will have to look for these basic facts elsewhere.

• To order The Devils' Alliance for £18.99 with free UK p&p call Guardian book service on 0330 333 6846 or go to guardianbookshop.co.uk.