In April 1978, a pro-Soviet government took control in Afghanistan and received economic assistance from Moscow.
September 1979, Hafizullah Amin staged a popular coup and toppled the pro-Soviet government.
At first Moscow supported him, however, Amin became increasingly unpopular as other pro-Muslim factions tried to overthrow him.
When Brezhnev heard rumours that Amin was talking to USA about support, he decided to act. On 24th December 1979, USSR invaded Afghanistan.
USSR claimed they invaded in order to support Amin, however, Amin was assassinated on the 27th of December (1979) and replaced by a pro-Soviet leader called Babrak Kamal
USSR remained in Afghanistan for almost 10 years fighting opponents of Kamal