Pakistan appears to enjoy a favorable geopolitical environment lately. Consider some recent examples: Islamabad signed a defense agreement with Saudi Arabia that effectively ties the two countries together and solidifies Pakistan’s position in the West Asian security dynamics. Meanwhile, Pakistan Prime Minister Shahbaz Sharif and the Army Chief Field Marshal Asim Munir were hosted by the White House. And Pakistan’s ties with China are as strong as they have ever been.

For a country that is mired in deep economic, political, and security challenges, the above geopolitical profile seems odd. How does Pakistan do this? What are the key elements of Pakistan’s survival and even revival? Four reasons stand out:

First is the strategic importance of Pakistan’s geography. The country borders Iran, Afghanistan, Central Asia, China, and India. Islamabad is a link between West Asia, South Asia and Central Asia. Any power that holds a presence in Pakistan is able to monitor and influence developments in these three regions. Pakistan was critical for the US War on Terror in Afghanistan, and continues to be useful in maintaining pressure on Iran and China.

In the evolving geopolitics, if President Trump does not get his desired Bagram airbase in Afghanistan, Pakistan will perhaps be more than willing to host the US military presence and support US operations. It has offered an Arabian Sea port to the U.S. For China, Pakistan is a key node in the Belt and Road Initiative (BRI) that links Western China with the Arabian Sea. Pakistan provides overland routes for China to reduce its dependence on the Strait of Malacca for energy imports.

Second is that Pakistan is in constant search of great power patronage. It is a country that is willing to provide bases and support the strategic activities of major global powers. To that end, Islamabad does not shy away from participating in treaties and forging military alliances. During the Cold War, Pakistan allied with the U.S. It also became a member of the US-led CENTO and SEATO – two treaties that sought to build regional coalitions in West and Southeast Asia against the Communist powers. Meanwhile, Islamabad was able to deftly handle the contradictions between membership of SEATO and the China-Pakistan axis. In the 1980s, Pakistan became a frontline state in the anti-Soviet Jihad in Afghanistan. Even now, despite the sharp deterioration in US-China relations, Pakistan is a close friend of both China and the U.S. Not many countries in the world can pull off this act of geopolitical jugglery.

The third reason is that Pakistan has strategically deployed its Islamic identity to engage with the West Asian countries. Due to its origins as a faith-based nation, it was natural for Pakistan to construct a stable and close relationship with Saudi Arabia. In the past, too, it has not shied away from supporting the Saudi monarchy in its strategic endeavors, including deploying a retired army chief for the war in Yemen. However, Pakistan has also been careful to ensure that its relationship with Saudi Arabia does not provoke Iran beyond a point.

The recently concluded Saudi-Pakistan defense agreement serves the interests of both sides. With the Israeli attacks in Qatar and firm US support for Tel Aviv, West Asian security calculus is in flux. America’s allies can no longer count on Washington’s security guarantees. Therefore, through this agreement, Saudi Arabia has attempted to demonstrate to the U.S. that it has other friends. Besides, Pakistan has been seeking external support in the wake of Operation Sindoor and has sought to wean the rich Gulf monarchies away from India so as to restore the strategic priority that Islamabad once enjoyed. It may not succeed.

Finally, Pakistan is willing and able to adjust its diplomacy in response to evolving global geopolitics, and this helps to cement its ongoing relevance. For example, to secure US support during the second Trump administration, Pakistan has situated itself as the partner of choice on issues such as cryptocurrency and rare earth mining. Pakistan has clearly understood how to keep the Trump administration happy, and in doing so reflects a recognition of its need for firm great power support for survival.

Along with these four strategies, Pakistan also has attempted to stay put and survive against all odds. The daunting challenges faced by Pakistan also provide a justification for its army to intervene in politics. Through the crises, Pakistan muddles along and when geopolitics opens up opportunities, it is ready to exploit them. It does not always come off. Taliban-ruled Afghanistan remains the biggest failure of Pakistan’s contemporary geopolitical strategy. Pakistan has been struggling to deal with Taliban. They have not been able to recover that ground.