In May, 1986, another Parcham supporter, Major General Mohammad Najibullah, became general secretary of the PDPA and later Afghanistan's president. Karmal was relieved of his position. Najibullah, the former head of the Afghan secret police, attempted to bring about national reconciliation but failed.
The mujaheddin continued their attacks against the Soviet-backed regime in the Afghan countryside, where the guerrillas still had the advantage. In November, 1987, another constitution was adopted that greatly increased Najibullah's power. He was granted the command of the armed forces, the right of approval or veto over all laws, the ability to appoint all high-ranking officials, and the power to convene or dissolve the national assembly. The country was also renamed the Republic of Afghanistan.
In April, 1988, the United Nations (U. N.) mediated an agreement, providing for the withdrawal of Soviet troops, an end to Pakistan's rebel support, and the repatriation of refugees. Although the Soviets completed their troop withdrawal in February, 1989, the divisions between the rebels continued to cause fighting against the government of Najibullah.
Assisted by weapons left by the departing Soviet troops, the Najibullah government managed to stay in power for three more years. In response to an attempted coup and declining Soviet support, Najibullah and his government proposed a series of constitutional amendments. These amendments were adopted in May, 1990. The power of the PDPA was reduced, and the socialist orientation of the country was lessened.