As President, Beneš faced two major crises, which both resulted in his resignation. His first resignation came after the Munich Agreement and subsequent German occupation of Czechoslovakia in 1938, which brought his government into exile in the United Kingdom. The second came about with the 1948 communist coup, which created the Czechoslovak Socialist Republic. Before his time as President, Beneš was also the first Minister of Foreign Affairs (1918–1935) and the fourth Prime Minister (1921–1922) of Czechoslovakia. A member of the Czechoslovak National Social Party, he was known as a skilled diplomat.