After meeting Afghan President Hamid Karzai in Kabul on Monday, Jamali said: "The fight against extremism and terrorism... there's no looking back. We have to go ahead with this, it is a menace all over the world. We go ahead hand in hand."
Karzai said Jamali's visit reflected the strengthening of ties between the two countries and that the leaders had discussed "terrorism" and economic ties.
Asked about security on the border between the two countries, Jamali said Pakistan would work towards eradicating the infiltration of fighters into Afghanistan.
"We want to ensure... that there is no criss-cross from Afghanistan into Pakistan and from Pakistan into Afghanistan.
Karzai said the visit reflected the
strong ties between the nations
"We will keep on making them (border control measures) better and keep on making them stronger so the people of both countries don't suffer at all," he said.
The issue of elements hostile to Karzai's government infiltrating Afghanistan from Pakistan remains a "serious concern", according to a United Nations Security Council report released on 30 December.
The Pakistani president said there were about 65,000 Pakistani troops on the border serving in about 800 military posts.
Jamali, on his first visit to Kabul as prime minister, also pledged to increase economic and transport links between the two countries and announced a donation of 100 buses and 200 trucks to its neighbour.