I think that we should look more closely at
NATO -- the North Atlantic Treaty Organization.
It was formed in the aftermath of World War II, when the Soviet Union ended up dominating most of Eastern Europe and remaking it in its Communist likeness.
NATO originated as the Western Union Defence Organization, formed in 1948 by Belgium, the Netherlands, Luxembourg, France, and the United Kingdom as a response to the Soviet Union's blockade of Berlin and a Soviet-supported coup in Czechoslovakia. In 1949, the United States, Canada, Portugal, Italy, Norway, Denmark and Iceland joined in, and NATO got its present name. A British official stated that it was "to keep the Russians out, the Americans in, and the Germans down".
Greece and Turkey joined in 1952, and West Germany in 1955. In response, the Soviet Union, Hungary, Czechoslovakia, Poland, Bulgaria, Romania, Albania, and East Germany formed the Warsaw Pact.
Around this time, French President Charles de Gaulle did some nationalist posturing, pulling France out of NATO's command, but still being in the alliance. France did not return until 2009.
Spain joined in 1982 when it became a democracy after the death of long-time dictator Francisco Franco.
The Soviet bloc fell over 1989 - 1991, with the Soviet Union breaking up and the Warsaw Pact being disbanded.
When East Germany joined West Germany in 1991, the reunified nation continued the NATO membership of its western half.
From
History of NATO - "There was no formal commitment in the agreement not to expand NATO to the east, but there are diverging views on whether negotiators gave informal commitments regarding further NATO expansion." The argument lots of contradictory statements, with some officials saying that NATO will not expand eastward toward Russia, and some others saying that NATO has made no such commitment.