The Afghan invasion ended in 1988 when the Soviet Union signed an accord with the United States, Pakistan and Afghanistan agreed to withdraw its troops. The Soviet withdrawal was completed on February 15, 1989, and Afghanistan returned to nonaligned status.