Mattis was on a day-long visit to Islamabad, where he held meetings with the country's civil and military leadership.
USA officials have always been frustrated by what they see as Pakistan's reluctance to act against groups such as the Afghan Taliban and the Haqqani network that they believe exploit safe haven on Pakistani soil to launch attacks in Afghanistan.
USA officials say they have not seen a change in Pakistan's support for militants, despite visits by senior U.S. officials, including Secretary of State Rex Tillerson.
The U.S., he said, has been very direct about what it expects Pakistan to do in the fight against the Taliban.
An official statement released here said Prime Minister Shahid Khaqan Abbasi met James Mattis who was accompanied by senior officials from Department of Defence and the U.S. ambassador to Pakistan David Hale.
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".
Mattis's brief visit to Islamabad comes a week after a hardline Pakistani Islamist group called off nationwide protests after the government met its demand that a minister accused of blasphemy resign.
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 United States would do "everything we can" to destroy them. The White House said the release could have repercussions for US-Pakistan relations.
Asif quoted Secretary Mattis as saying; "We are aware of the human cost Pakistan has paid in this war on terror".
Mattis was in Pakistan for a few hours before he flew to Kuwait. The threat is worse because Pakistan and India are two nuclear-armed states whose tense relations threaten to spiral into conflict.
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".
"The prime minister reiterated that there are no safe heavens in Pakistan and the entire nation was committed to its resolve on eradicating terrorism once and for all in all its forms and manifestations", according to Islamabad's statement on the meetings.
"Forum also discussed regional and internal security situation with specific reference to Afghanistan".
In the meantime, ABC News reported that both sides released comments saying that the United States and Pakistan want to continue to work together and that Islamabad plays a key role in the struggle for peace in Afghanistan.
The forum, the communiqué said, concluded to continue efforts towards internal enduring peace while contributing towards peace in Afghanistan and the region. 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 worldwide community.
He reiterated Pakistan's support to peace and stability in the region and highlighted Pakistan's concerns emanating from Indian use of Afghan soil, the necessity and right of Afghan refugees for a respectable & early repatriation and the existence of terrorist safe havens across the border in Afghanistan.
Bajwa, in a statement, said Mattis expressed concern about militants in Pakistan trying to "further their terrorist agenda" in Afghanistan and said he is "prepared to look into the possibility of miscreants exploiting Pakistan's hospitality".