Here's an interesting interview of Major (retd) Muhammad Amir of Inter-services Intelligence (ISI) with Shahid Masood, aired on 5 September 2021.
Major Sahib explains that Pakistan had considered Soviet Union as it's main enemy and that it was the Soviet Union which was responsible for the break up of Pakistan in 1971.
He goes onto say that the US and the Soviet Union had an understanding in 1979. Which was that the Soviet Union will look the other way while the US topples the pro-Soviet President Idi Amin in Uganga and in return, the US will not be too critical of the Soviet invasion of Afghanistan.
Pakistan's Inter-services Intelligence (ISI) had found out that the Soviets were planning an invasion of Afghanistan and it informed President Zia-ul-Haq in June 1979, who in turn then wrote to President Jimmy Carter in July 1979. However, the US President did not respond due to the above mentioned understanding between the US and USSR.
The Soviet Union invaded Afghanistan in December 1979 and President Jimmy Carter wowed to defend the Persian Gulf in January 1980 (without committing any soldiers).
The US did send it's National Security Adviser Zbigniew Brzezinski to Pakistan in
February 1980. His advice to President Zia-ul-Haq was, "
Not to engage the Soviet Union in Afghanistan." Instead, the US would provide $400 million to Pakistan to fortify it's border with Afghanistan so there's no fallout on the Pakistan side.
President Zia-ul-Haq
rejected the offer and instead told the US National Security Adviser, "
Thank you very much for the nice advice. You may now go and relax. We will not only engage the Soviet forces but we will drive them back (out of Afghanistan)."
The next day, President Zia-ul-Haq ordered the military to act swiftly against the Soviet forces before they could fortify their positions on the Pak-Afghan border.
Pakistan confronted the Soviet war machine on its own for around 2-years before the US finally stepped in with military assistance to Pakistan.
The nearly decade long war took it's toll on the Soviet Union, eventually leading to the dissolution of the Empire and creating 11 independent nations in its place
Please watch from 16:00 onwards.
I have to admit I've always heard from the civilian and the military establishment that Pakistan was used by the United States in the 1980s instead of Pakistan actually wanting to take on the Soviet Union to take revenge for the 1971 war.