Russian President Vladimir Putin (R) greets Pakistan's Prime Minister Nawaz Sharif during the BRICS Summit in Ufa, Russia on July 9, 2015. REUTERS/Sergei Karpukhin

Former Cold War-era rivals Pakistan and Russia are due to hold their first ever military exercise this month, Pakistan's military said on Friday, in another sign of shifting alliances in South Asia.

During the Cold War, Pakistan spent a decade helping the United States funnel arms and fighters into neighboring Afghanistan to help insurgent groups fight Soviet soldiers following their 1979 invasion of Afghanistan.

At the time, the communist Soviet Union was closely aligned with Pakistan's arch-enemy India, while the United States was a staunch supporter of Pakistan.

Pakistan's top military spokesman, Lieutenant General Asim Bajwa, said a "contingent of Russian ground forces" arrived in Pakistan for a two-week exercise beginning on Saturday.

About 200 military personnel from both sides would be involved in the exercises, Pakistan's Tribune Express newspaper said, citing military sources.

Pakistani media last year reported Islamabad had bought four Mi-35 attack helicopters from Russia in a first military deal of its kind between them.

While ties between Russia and Pakistan are growing closer, Pakistan's relations with the United States have cooled. Washington accused Islamabad of harboring Afghan Taliban fighters, something that Pakistan denies.

The United States has also improved ties with India, which Pakistan views warily.

Pakistan's relations with its steadfast, "all-weather" ally China have developed over the past year or so with a plan for $46 billion in Chinese investment in a road and rail energy corridor linking western China with Pakistan's Arabian Sea coast.