"As part of a Cold War strategy, in 1979 the United States government (under President Jimmy Carter and National Security Advisor Zbigniew Brzezinski) began to covertly fund and train anti-government Mujahideen forces through the Pakistani secret service known as Inter Services Intelligence (ISI)."
The Afghani government at that time was communist.