KABUL, Afghanistan — Afghan President Ashraf Ghani and Pakistani Prime Minister Nawaz Sharif on Tuesday emphasized messages of unity and common purpose amid continuing fighting with militants on both sides of the border.

Tuesday’s visit was the first time Sharif had visited the Afghan capital since Ghani was named president after a disputed election last year.

The relationship between the two countries has been fraught with distrust. Pakistan has a long and controversial relationship with Taliban militants in neighboring Afghanistan, with leaders in Kabul often accusing Pakistan of harboring and supporting insurgent forces out of the reach of Afghan troops.

But on Tuesday, the two leaders repeatedly declared that Afghanistan and Pakistan will work together to face the insurgent threat that has destabilized the region for more than a decade.

“There are no good terrorists or bad terrorists, just terrorists, and this means we must work together,” Ghani said during a joint press conference at his palace in Kabul. “The enemies of Afghanistan are the enemies of Pakistan, and the enemies of Pakistan are the enemies of Afghanistan.”

Ghani said the discussions during the official visit revolved around common threats and interests, including economic and energy issues. But both leaders agreed that the region would continue to suffer as long as militant factions were able to destabilize the countries.

“Pakistan has a stake in a peaceful Afghanistan,” Sharif said. “The enemies of Afghanistan cannot be friends of Pakistan.”

The NATO-led international military coalition formally declared the end to its combat mission at the end of 2014. Although coalition airstrikes and special operations missions continue at a significantly scaled-back level, Afghan forces are squaring off with resurgent militants across the country. In northern Afghanistan, Taliban forces reportedly backed by fighters from Pakistan have launched offensives across wide swaths of Kunduz province and other areas.

Sharif vowed that any militant groups threatening Afghanistan’s security would be “outlawed and hunted down” by Pakistan forces.

“All sanctuaries when found will be eliminated by direct action,” he said.

The two delegations agreed on three main points to govern their security cooperation, Sharif said. The governments agreed to adhere to policies of non-interference in each other’s internal affairs; to prevent militants from using each country’s territory as a base to attack the other; and to treat the enemies of one country as the enemies of both.

The Pakistani prime minister also confirmed his support for an “Afghan-led peace and reconciliation process.” Afghan officials began informally meeting with Taliban emissaries in Qatar at the beginning of May.

Sharif was accompanied by Army Chief Gen. Raheel Sharif and the head of Pakistan’s intelligence agency, Gen. Gizwan Akhtar. Among the Afghan officials receiving them were Gen. Sher Mohammad Karimi, acting head of the Afghan military, and Rahmatullah Nabil, who heads Afghanistan’s intelligence agency. Sharif also met with Afghan chief executive officer Abdullah Abdullah, who was named to that position as part of a negotiated government of national unity following 2014’s disputed election between Ghani and Abdullah. Twitter: @joshjonsmith

Sign Up for Daily Headlines

Sign up to receive a daily email of today's top military news stories from Stars and Stripes and top news outlets from around the world.

Sign Up Now