You know, you learn lots by skimming Wikipedia...
The problems started with Nur Mohammed Taraki .
He wanted to drag Afghanistan, an Islamist state, kicking and screaming into the 20th century via the secular politics of the communist persuasion. He had the Russians as his major international political ally. The Islamists (read that to mean the vast majority of political players) were feeling very threatened, and repression against him and other leftists began. Bloodbath time.
He staged a coup, and he and his communists took over in 1978. "Reform" of the Afghani Islamist culture and tradition commenced, big time, in the form of brutal suppression. Dear reader, you would have loved him. He was your kind of man... Progressive, enlightened, ... and brutal. A leftist-inspired bloodbath ensued.
Taraki was also responsible for introducing women to political life. A prominent example was Anahita Ratebzad, who was a major Marxist leader and a member of the Revolutionary Council. Ratebzad wrote the famous New Kabul Times editorial (May 28, 1978) which declared that Privileges which women, by right, must have are equal education, job security, health services, and free time to rear a healthy generation for building the future of the country....Educating and enlightening women is now the subject of close government attention.
But the Islamists, especially the hard liners, were having none of it, and serious repression (we're talking mass-murder here, dear reader) was needed to stay in power. In 1979 Taraki asked the Soviets to send ground troops, but the Russians told him "we believe it would be a fatal mistake to commit ground troops... if our troops went in, the situation in your country... would get worse." An astute assessment. Pity they didn't remember this a few months later...
Despite this statement Taraki negotiated some armed support - helicopter gunships with Russian pilots and maintenance crews, 500 military advisors, 700 paratroopers disguised as technicians to defend Kabul airport, also significant food aid (300,000 tons of wheat). Brezhnev still warned Taraki that full Soviet intervention "would only play into the hands of our enemies - both yours and ours."
And then shit happened. In the usual form. Political in-fighting. Taraki was assassinated and a dude by the name of Hafizullah Amin
Amin began unfinished attempts to moderate what many Afghans viewed as an anti-Islam regime. Promising more religious freedom, repairing mosques, presenting copies of the Qur'an to religious groups, invoking the name of Allah in his speeches, and declaring that the Saur Revolution was "totally based on the principles of Islam." Yet many Afghans held Amin responsible for the regime's harshest measures.
Amin started a purge of his opponents, including Soviet sympathisers . Bloodbath time again.
The Soviets, unhappy with the deaths of their loyal minions, and the fact that Amin was getting too friendly with the Americans, and against their own earlier better judgment, invaded on 24 December 1979. The Soviets had marched into their own Vietnam. Bloodbath time again.
The radicalisation of the Afghani Islamists was now almost complete. The finishing touches were delivered by way of the CIA funding, training and arming any fundamentalist Islamist group willing to kill Soviets. The front organisation for all of this was Pakistan's premier intelligence agency, the ISI. Bloodbath time again.
And so the fundamentalist Islamists, soon to morph into the Taliban, and with huge American aid, and with the help of one of the CIA's own Saudi pin-up boys, Osama bin Laden, reclaimed Afghanistan and began "the restoration of Islamic values". Bloodbath time again.
But... Osama had as much of a problem with American meddling in Islamic lands, as he did with the Soviets, and he put his CIA training to excellent use. Eventually even on American soil. Bloodbath time again.
Stupid bin Laden... He failed to understand that the Americans were never going to take that lying down, and Afghanistan, always the central piece in The Great Game,
was now considered fair game. Bloodbath time again.
And the bloodbath continues. America is now trying, desperately, to pull off what the Russian Empire could not, what the British Empire could not, what the Soviet Union could not - namely, to get the Afghani people to submit to foreign intervention and control, either directly, or through the installation of a puppet government.
Based on history, I don't like their chances...