Given this paragraph about the Cold War, why did the Soviets pull out of their war in Afghanistan?

The Soviets withdrew from the Soviet-Afghan War beginning in May 1988 due to international opposition, persistent anti-Soviet guerrilla warfare, and a lack of support by Soviet citizens.