The Allies, after World War II, split Berlin into four zones, with the British, the French, the Americans and the Soviets each occupying a zone.
The East German government, in 1961, built the Berlin Wall, which prevented East Berliners and East Germans from accessing West Berlin.

Picture taken ~ 1986 on the west side of the Berlin Wall, near Checkpoint Charlie. Pictured: Dan Reid and Keith Green.
The mission of deterring aggression and the defense of West Berlin from the East German Military and the Soviet Union fell to the US Berlin Brigade along with the French and British forces station in West Berlin.
From 1985 to 1988, I served with the US Berlin Brigade. We specialized in Military Operations in Urban Terrain (MOUNT). However, if the East German army and the Soviets (hundreds of thousands of soldiers) attacked West Berlin, the allied forces (~12,000 soldiers) would hold out from a few days to about a week.
I’m not aware of anyone that believed the East Germans and the Soviet Union would attack West Berlin. No one wanted a full-scale nuclear war. I was wrong.
The Berlin Wall fell in 1989, and Germany started reunification. The fall of the Berlin Wall meant the Stasi, the East German secret police and intelligence agency, files were available to the public.
According to the Stasi files, the Stasi and the East German army had plans for the invasion of West Berlin, which included dividing the conquered West Berlin into Stasi branch offices, the number of men to assign to each branch and they even cast medals to award after a successful invasion. (Funder,2014, p. 72).
An invasion of West Berlin depended on Soviet approval and support. The party chairman and the leaders of the Soviet Union would not give their approval or support without a decisive military edge for an offensive war. The economic condition of the communist economy and the cost of the arms race finally caused the Soviet leadership to reject an offensive war in 1987. (Wenzel, 1994)
References:
Funder, Anna. Stasiland: Stories from Behind the Berlin Wall. Kindle Edition.
Wenzel, O. (1994). East German plans for the conquest and occupation of west … – ciar.org. http://ciar.org/ttk/mbt/armor/armor-magazine/armor-mag.1994.nd/6berlin94.pdf