The predecessor of the KGB of the Estonian SSR, then called the People’s Commissariat for Internal Affairs (NKVD) of the Estonian SSR, was founded in 1940 after the occupation and annexation of Estonia by the Soviet Union. In 1941–1953, it acted as the ESSR Security Service under the USSR People's Commissariat for State Security (NKGB) and the Ministry of State Security (MGB). In 1954, the State Security Committee of the Estonian SSR was established, and worked under the Council of Ministers of the Estonian SSR. The KGB was closed down in Estonia after 1991, but the process was slow, enabling an extensive part of its documentation to be moved out of Estonia.