The CIA created the anti-Russian forces in Afghanistan prior to the Soviet invasion:
"Operation Cyclone was the code name for the
United States Central Intelligence Agency (CIA) program to arm and finance the
Afghan mujahideen in
Afghanistan from 1979 to 1992, prior to and during the
military intervention by the
USSR in support of the
Democratic Republic of Afghanistan.
Operation Cyclone - Wikipedia
"The mujahideen were also supported by Britain's
MI6, who conducted separate covert actions.
"The program leaned heavily towards supporting militant Islamic groups, including groups with
jihadist ties, that were favored by the regime of
Muhammad Zia-ul-Haq in neighboring
Pakistan, rather than other, less ideological Afghan resistance groups that had also been fighting the Soviet-oriented
Democratic Republic of Afghanistan administration since before the Soviet intervention.
[1]"