Afghanistan had been non-aligned during the early stages of the Cold War, but a 1973 coup had brought a pro-Western government into power. Five years later, Communists under the leadership of Nur Muhammad Taraki seized power. The new regime—which was divided between Taraki's extremist Khalq faction and the more moderate Parcham—signed a treaty of friendship with the Soviet Union in December 1978. Taraki's efforts to improve secular education and redistribute land were accompanied by mass executions and political oppression unprecedented in Afghan history, igniting a revolt by mujahideen rebels. Following a general uprising in April 1979, Taraki was deposed by Khalq rival Hafizullah Amin in September. Soviet leaders feared that an Islamist government in Afghanistan would threaten the control of Soviet Central Asia, and, as the unrest continued, they deployed 30,000 soldiers to the Soviet–Afghan border. Carter and Brzezinski both saw Afghanistan as a potential "trap" that could expend Soviet resources in a fruitless war, and the U.S. began sending aid to the mujahideen rebels in early 1979. By December, Amin's government had lost control of much of the country, prompting the Soviet Union to invade Afghanistan, execute Amin, and install Parcham leader Babrak Karmal as president.