Pakistani Prime Minister Imran Khan has held his first face-to-face talks with US President Donald Trump during a trip to Washington DC.
The meeting was part of a push to mend relations, which have been strained by the Afghan conflict.
Mr Trump reduced security aid to Pakistan early last year, accusing the country of "lies and deceit".
At the White House meeting on Monday, Mr Trump also offered to mediate in the Indian-Pakistani conflict in Kashmir.
He said that he was making the offer after Indian Prime Minister Narendra Modi requested that he "mediate or arbitrate" in the 70-year-old territory dispute between the two nations.
"If I can help, I would love to be a mediator," Mr Trump said on Monday.
"If I can do anything on that let me know."
What else did the leaders say?
Mr Trump said that Pakistan was helping the US to "extricate" its troops from Afghanistan, through political negotiations.
The US president said he could win the war in Afghanistan within 10 days, but that he did not want to kill millions of people. He is aiming to persuade Mr Khan to pressure the Taliban into striking a peace deal with the Afghan government.
Mr Khan praised the negotiations, saying: "There is no military solution in Afghanistan. If you go all out military, millions and millions of people will die."
Mr Trump added that before Mr Khan came into office, the country had been "subversive" to US interests and "did not respect US leadership".
What are the diplomatic tensions?
Since he won Pakistan's general election just under a year ago, Mr Khan has called for "mutually beneficial" ties with America, while remaining an outspoken critic of US anti-terrorist tactics such as drone strikes.
The Trump administration is trying to negotiate its military withdrawal from Afghanistan with the Taliban, a militant group it has long accused Pakistan of supporting.
Mr Khan has previously said that US assistance was "minuscule" compared with what the US-led "war on terror" had cost Pakistan.
As well as counter-terrorism and defence, the two leaders were likely to discuss trade and investment as Mr Khan battles to fend off a balance of payments crisis after a bailout from the International Monetary Fund.
How did relations fray last year?
Since Donald Trump took office in 2017, his administration has adopted a hard line against Pakistan, accusing it of supporting Islamist militants and misleading the US over the issue - charges Islamabad denies.
Mr Trump began 2018 by promising on Twitter to end "foolish" aid to the country.
The United States has foolishly given Pakistan more than 33 billion dollars in aid over the last 15 years, and they have given us nothing but lies & deceit, thinking of our leaders as fools. They give safe haven to the terrorists we hunt in Afghanistan, with little help. No more!— Donald J. Trump (@realDonaldTrump) January 1, 2018
As much as $2bn (£1.6bn) in US security assistance has been suspended.
After Mr Trump tweeted again in November to remind Pakistan that 9/11 mastermind Osama Bin Laden had lived there before finally being hunted down by US forces, Imran Khan shot back to "put the record straight" on which country had paid more to defeat terrorism.
Record needs to be put straight on Mr Trump's tirade against Pakistan: 1. No Pakistani was involved in 9/11 but Pak decided to participate in US War on Terror. 2. Pakistan suffered 75,000 casualties in this war & over $123 bn was lost to economy. US "aid" was a miniscule $20 bn.— Imran Khan (@ImranKhanPTI) November 19, 2018
However, a couple of months before that Twitter clash, US Secretary of State Mike Pompeo had already raised the prospect of a reset with the new government of Mr Khan.
According to Pakistan's foreign office, Mr Khan's visit "will help renew and reinvigorate long-standing ties between Pakistan" and the US.
Adding to the positive mood music came a new tweet from Mr Trump last week, announcing that Pakistan had arrested the "mastermind" of the 2008 terror attacks in the Indian city of Mumbai, after a search lasting two years.
After a ten year search, the so-called “mastermind” of the Mumbai Terror attacks has been arrested in Pakistan. Great pressure has been exerted over the last two years to find him!— Donald J. Trump (@realDonaldTrump) July 17, 2019
In actual fact, the man arrested, Hafiz Saeed, has been arrested and freed several times by the Pakistani authorities over the past two decades. Far from hiding, he has even addressed rallies and campaigned in recent Pakistani elections.
Pakistan will hope the arrest will help persuade the Financial Action Task Force (FATF), a global watchdog against money laundering and terrorism financing, not to blacklist it in the coming months.
Khan and Trump basics
- Khan, 66, was best known as Pakistan's most famous cricketer before he took office as prime minister in July 2018 following his PTI party's election victory; property tycoon and reality TV star Trump, 73, took office as US president in January 2017
- Khan governs a nation of 197 million people; Trump - 316 million
- Trump is an avid tweeter with 62m followers; Khan has just under 10m
- Imran Khan: From cricket hero to Pakistani PM
How crucial is Afghanistan to the relationship?
Writing in Foreign Policy, Sherry Rehman, Pakistan's ambassador to the US between 2011 and 2013, argues that "stabilizing Afghanistan is Pakistan's only real trump card" in its dealings with the US.
Pakistan has always denied it was the architect of the Taliban. It was one of only three countries to recognise them after they took power in Afghanistan in 1996 and the last to break diplomatic ties when US-led forces ousted the movement after the 9/11 attacks in 2001.
Few observers doubt that Pakistan has been instrumental in getting the Taliban to the table for direct talks with members of the Afghan government this month, a negotiation praised by US lead negotiator Zalmay Khalilzad as a "big success".
The Trump administration is keen to end a war which, according to US officials, costs about $45bn annually, and to withdraw most or all of the 14,000 American soldiers deployed there.
In the opinion of Ms Rehman, Pakistan has already "received some muted recognition of its unprecedented efforts to facilitate these delicate negotiations" in two respects this month:
- The US listed the Balochistan Liberation Army, a separatist group active in Pakistan, as a terrorist group
- The IMF approved a $6bn loan package for Pakistan
"Pakistan has been facilitating the US-Taliban talks in good faith, underscoring that it remains a shared responsibility," Foreign Minister Shah Mehmood Qureshi said recently.
"It will therefore be appropriate to work for broader engagement from Afghanistan to bilateral issues, economic and trade co-operation, to peace and stability in South Asia."
What are Khan's economic aims?
The US, a major source of foreign investment in Pakistan, remains its largest export market, so trade is very much on the agenda in Washington.
However, financial pressures have led Pakistan to go further afield in search of aid and it attracted Saudi pledges of investment deals worth $20bn this year.
Given that Pakistan is so strapped for cash, Mr Khan has been keen to portray an image of austerity. He used to be known as a celebrity playboy but now styles himself as a pious, anti-poverty reformer.
Before he left for the US, reports said he planned to stay at the Pakistan ambassador's residence in Washington, rather than waste money in an expensive hotel.
Pakistan has also been seeking new assistance from China, its biggest foreign investor and also a major aid donor.
So Imran Khan must tread a delicate path between Mr Trump's America and its economic arch-rival, Beijing.