As the clock ticked down to US President Donald Trump's deadline to destroy Iran's civilisation last week, hope emerged from an unlikely corner, with Pakistan's prime minister first seeking -- and within hours securing -- a two-week ceasefire between the warring sides.
Now, with a round of talks concluded in Islamabad and frantic negotiations underway to secure a second go, Pakistan is basking in its new role as a regional peacemaker, analysts say.
"Pakistan very much wants to ride the momentum that it has been enjoying over the last few weeks as a critical mediator," Michael Kugelman, senior South Asia fellow at the Atlantic Council, told AFP.
It is a remarkable turnaround for a South Asian country long seen internationally through a security lens, as it battled armed extremists and separatists at home while being accused of supporting the Taliban in Afghanistan.
The mediator of peace talks had itself just fought battles with its neighbours last year -- Pakistan fought a brief but intense war with India in May, and two rounds of conflict with neighbouring Afghanistan, where Islamabad accuses the Taliban authorities of harbouring armed groups.
Raja Qaiser Ahmed, a professor of international relations at Islamabad's Quaid-i-Azam University, said Pakistan's robust military responses in both conflicts helped burnish its regional credentials.
"In international politics, the currency is power," he said. "When you have demonstrated it operationally, and now you are just building it up diplomatically."
Kugelman hailed Pakistan as "an unsung success story when it comes to strategic autonomy."
"Pakistan is looking to change global perceptions about its capacities as a global player," he said.
"It does not like the fact that it has a poor global image and wants to essentially push back against its critics and show that it has the capacity to affect change and be influential on the global stage."
- Unique geography -
When the US-Israel war on Iran broke out, quickly engulfing the Middle East, Islamabad was careful not to take sides between Washington and Tehran.
Since US President Donald Trump took office, Pakistan has seen ties warm significantly, after Islamabad lauded him for having helped mediate the end of the conflict with India. Delhi denies Washington played a significant role.
A visit to Washington by Pakistani PM Shehbaz Sharif and powerful army chief Asim Munir followed, with Trump now often referring to the latter as his "favourite field marshal".
Pakistan shares a 900-km border with Iran, with whom it has maintained warm -- if sometimes testy -- relations, with the countries sharing significant cultural and trade ties.
Early on Sunday, when US Vice President JD Vance took the podium in Islamabad to declare that no agreement had been reached after marathon 21-hour talks, he was also quick to praise Pakistan.
He thanked Sharif and Munir by name, saying they "did an amazing job and really tried to help us and the Iranians bridge the gap and get to a deal."
Iran's top negotiator Mohammad Bagher Ghalibaf had similar words of thanks.
Asif Durrani, a former Pakistani ambassador to Tehran, said Pakistan had proven its importance with the talks, even if the first round did not lead to a deal.
"I think Pakistan is a power to be reckoned, and very much Pakistan is a player. Its geography is so unique that it cannot be ignored," he said.
As a neighbour of China as well, Pakistan has cultivated good relations with Beijing, which diplomats and Trump himself have said was key in getting Iran to the negotiating table.
Pakistan also has close ties with the Gulf nations that have been pulled into the conflict by Iranian retaliatory action. That includes Saudi Arabia, with whom it has a mutual defence pact.
On Monday, Pakistani PM Sharif said efforts remained underway to continue negotiations, and a second round of talks remained a possibility.
Vance, however, has taken a harder line, suggesting in an interview on Fox News that while further talks were possible, there was "no flexibility" on Iran's nuclear programme.
For Kugelman, even if there is a return to fighting, Pakistan would still emerge with its international image enhanced.
"I think that even if the war resumes, it will not suffer reputational cost. I would argue that if anything, it's enjoyed reputational boost because it's been able to push back against criticism that it doesn't have the capacity to pull off this type of diplomacy," he said.
"It's also strengthened its image. It's been able to project itself as a peacemaker."
J.Jaspers--LCdB