According to the western allies, the occupation of most of Germany ended in 1949 when the Federal Republic of Germany and the German Democratic Republic were set up. But the occupation of Berlin could only be ended by a quadripartite (four power) agreement, so Berlin remained an occupied territory under the formal control of all the allies. This is why the "Grundgesetz" (constitution of the Federal Republic) never applied in West Berlin.