The premier also appreciated the US's resolve not to allow the use of Afghan soil against Pakistan. They then would return to their safe havens in Pakistan, where they have had a long-standing relationship with the ISI, Islamabad's intelligence agency.
A day before the Mattis arrived in Islamabad, Central Intelligence Agency Director Mike Pompeo had warned Pakistan that if it does not eliminate the alleged safe havens inside its territory, the U.S. would do "everything we can" to destroy them.
In brief comments before their meeting began, Pakistan Prime Minister Shahid Khaqan Abbasi said his country is committed to the war on terror and shares the same common objectives as the U.S.
Since the start of the war in Afghanistan, militants in Pakistan have crossed the mountainous and ill-defined border to wage attacks against U.S., Afghan and allied forces.
Asked if he was going to press the Pakistani leaders to take more action against the insurgents, Mattis said: "That's not the way I deal with issues".
Last week, United States and North Atlantic Treaty Organisation forces commander in Afghanistan General John Nicholson alleged Pakistan had not taken steps against the terrorists to satisfy Washington. The White House said the release could have repercussions for US-Pakistan relations.
Mattis' trip to Pakistan comes at the end of a short trip to the region, including stops in Egypt, Jordan and Kuwait.
"I think for Pakistan, the timing is very bad".
"Pakistan is genuinely concerned", he said.
The US is also furious over the release of Jamaat-ud Dawa chief Hafiz Saeed - whom the US and India accuse of masterminding the 2008 Mumbai attacks that killed 166 people.
"Mattis stated that the goal of his visit was to find common grounds in order to create a positive, consistent and long term relationship with Pakistan", the statement said.
A statement from Abbasi's office said the prime minister talked about recent counterterrorism operations and said Pakistan "would continue to conduct intelligence-based operations all over the country".
He reiterated there were "no safe havens in Pakistan" and the entire nation was committed to its resolve on eradicating terrorism once and for all in all its forms and manifestations.
"[The] forum also discussed regional and internal security situation with specific reference to Afghanistan", said the ISPR handout.
"The Secretary emphasized the vital role that Pakistan can play in working with the United States and others to facilitate a peace process in Afghanistan that brings stability and security to the region", the statement said.
In a blunt assessment early last week, Gen. John Nicholson, the top USA commander in Afghanistan, said there have been no changes in Pakistan's support for militant networks. He said that Pakistan had done much more than its due share despite capacity constraints but will remain committed for peace as a responsible member of the global community.
Gen Mattis expressed his respect for Pakistan Armed Forces and the effective operations undertaken against terrorists. He assured the COAS that U.S. was ready to play its role in addressing Pakistan's legitimate concerns, saying that his aim was not to make demands but find common grounds to work together. "We have eliminated safe havens from Pakistan's soil but are prepared to look into the possibility of miscreants exploiting Pakistan's hospitality to the Afghan refugees to the detriment of our Afghan brothers", he said.