The former King Michael of Romania, who has died aged 96, was the last surviving head of state from the second world war. Trapped between two giant war machines, he was eventually ousted by the Soviets in 1947, having helped end his country’s alliance with the Nazis three years earlier. This discreet man, who lunched with Adolf Hitler and shook hands with Winston Churchill, cut an unlikely hero. However, Michael’s decisive arrest of the Romanian dictator Marshal Ion Antonescu, an ally of Hitler’s, on 23 August 1944, and his subsequent ability to carry the Romanian army with him against the Germans, was a boost for the allies on the eastern front.

For years the Soviet Union took credit for the outcome of this political gamble, which had shocked Hitler, when in fact it was the Romanians at the behest of Michael who switched sides and repelled the Germans, with the Red Army rolling into Bucharest 10 days later.

King Michael attending a ceremony during which he was awarded the freedom of the City of London in 2011. Photograph: Vadim Ghirda/AP

From the outset Michael’s wartime position was unenviable. With the abdication of his playboy father, King Carol II, in 1940, what had been an unpopular royal dictatorship gave way to a military one, with the German sympathiser Antonescu at the helm. Michael, just 18 years old, poorly educated and isolated, was reduced to the status of a ceremonial figure. Nonetheless, he warned against the invasion of the USSR and was shocked by the harrowing conditions of Romanian soldiers on the frontline. He walked a diplomatic tightrope, keen to remain loyal to the armed forces but increasingly at odds with Antonescu’s war aims, which cost hundreds of thousands of Romanian lives.

Both Hitler – whom Michael reluctantly met in December 1941, noting the Führer “howled like a savage” – and Antonescu underestimated the Romanian monarch, writing him off as too young to rule. However, this “puppet king” had by 1943 made his opposition to the Axis clear. He intervened alongside his mother, the former Princess Helen of Greece and Denmark, on behalf of Romania’s persecuted Jews, established secret links with the allies and in 1944 became the focal point for a small group of Romanian politicians ready to risk a coup against Germany.

Michael hoped that the arrest of Antonescu, which nearly cost him his life – the royal palace was bombed by the Germans the day after the King left – would not only end the war with Russia but also lead to the re-establishment of parliamentary democracy in Romania.

Carol II, seated left in carriage, with his son, Crown Prince Michael, in June 1939. They were on their way to the opening of parliament. Photograph: Keystone/Getty Images

What he did not know was that by October 1944 Churchill’s percentages agreement with Stalin offered the Soviet Union a 90% say in Romania in exchange for a 90% say for Britain in Greece. After Michael’s coup d’etat, for which he was awarded the Legion of Merit by the US president Harry Truman, it became rapidly apparent his country had been occupied. Michael, after four years with the Nazis, now had to contend with the Soviets.

In 1945 a British foreign official wrote: “Michael is the only person who may be able to pull the country through the coming months and save it from anarchy or communism.” Although constantly disappointed by the west’s failure to act and bullied by the notorious Andrei Vyshinsky, the prosecutor of Stalin’s 1930s show trials, Michael was the last monarch to abdicate from behind the Iron Curtain. In the face of Russian intimidation and intrigue he opted to go on strike, refusing to sign any royal decrees while he pressed Washington and London to act. Help was not forthcoming.

In October 1947, with Romania’s leading opposition politicians arrested, the communists no longer needed the cover of monarchy. Despite the risks, Michael returned to Romania in December that year after attending Princess Elizabeth’s wedding in London. Back in Bucharest he was promptly forced to sign his own abdication: the palace was surrounded and the death of 1,000 students was threatened if he did not acquiesce.

Four days later, Michael left Romania by train with his mother; it would be more than four decades before he returned to his homeland. Exile was for Michael one more knock in a lifetime of disappointments. From an early age he had been exposed to a toxic mix of instability and responsibility.

The great-great-grandson of Queen Victoria on both sides of his family, he was born in the mountain resort town of Sinaia, the son of Princess Helen and Carol, the crown prince of Romania, a man already notorious for his volatility and womanising. By 1925 Carol had abdicated his right to the throne, making Michael, aged five, the youngest crowned head in Europe when his grandfather King Ferdinand died in 1927. The little boy was confused when people kept calling him “your majesty”.

King Michael of Romania abdicates

The honour did not last long; his father returned in 1930, hell bent on getting rid of Helen and installing himself, his lover, Elena Lupescu, and their favourites at court in what eventually became a flimsy dictatorship. Michael spent his teenage years sidelined, desperately missing his exiled mother and hating Elena. The result was a boy who grew up with a taciturn reputation and a speech impediment. It was this 18-year-old who returned to the Romanian throne in 1940.

When Michael’s second reign abruptly ended in 1947, life in exile came as a shock. His loving marriage to Princess Anne of Bourbon-Parma in 1948 and their five daughters gave him a family life, but the daughters remember a “silent, sad, serious” man during their childhood. He tried his hand at chicken farming in Hertfordshire, commercial flying in Switzerland and stockbroking in the US while simultaneously working with the national committee he had established to maintain links with Romania.

Another blow came after Romania’s bloody uprising of 1989 and the assassination of the communist dictator Nicolae Ceauşescu. The emergent ruling clique – the National Salvation Front – took extraordinary measures to keep out the exiled king. After several refusals, he was eventually permitted to return to Romania for Easter celebrations in 1992, and despite decades of anti-monarchist propaganda, the old king was greeted by thousands of people. He told the crowd: “I love you.” This simple display of affection was followed by another ban on his re-entry into Romania. It was not until 1996 and the election of a more centrist government that the communist decree of 1948 was finally annulled and Michael was allowed to return, in “a private capacity”.

In 2001, the government granted him an official residence and staff, in line with other former heads of state. Four years later Michael and his family were further compensated for confiscated property and permitted to use Elisabeta Palace in Bucharest. On his 90th birthday, he made his first speech to the Romanian parliament in more than six decades, calling for a break with the bad political habits of the past.

In 2014 Michael cut from the succession his daughter Irina on the basis of her guilty plea to abetting a cock-fighting business in Oregon and the following year he caused a scandal in the Romanian press when his only grandson, Nicholas, the “popular prince”, was also removed from the succession. Nonetheless, these incidents are of little consequence, given that any hopes a constitutional monarchy might be reinstalled in Romania have died with Michael.

Anne died last year. He is survived by their daughters, of whom Margareta succeeds him as nominal monarch.

• Michael von Hohenzollern-Sigmaringen, former king of Romania, born 25 October 1921; died 5 December 2017