The KGB was the main security agency for the Soviet Union from 1954 until its collapse in 1991. It was responsible for a wide range of activities, including intelligence gathering, counterintelligence, and secret police functions, and played a significant role during the Cold War.