When Mikhail Gorbachev came to power, the USSR was already facing a stagnant economy, the ruinous war in Afghanistan, and a surge of military spending by the United States.