KABUL (Reuters) - Afghanistan’s President Ashraf Ghani said on Wednesday that the “keys to war are in Islamabad, Quetta, Rawalpindi” - all cities in Pakistan - suggesting the neighboring country was a safe haven for cross-border militant activities.

Afghanistan's President Ashraf Ghani speaks during a live TV broadcast at the presidential palace in Kabul, Afghanistan January 28, 2019. Presidential Palace office/Handout via REUTERS

Afghanistan has previously accused Pakistan of turning a blind eye to Afghan Taliban commanders on its soil and even of supporting the militant group it is fighting, which Islamabad denies.

Ghani said the “key to peace was in Afghanistan”, as talks between Taliban and U.S. officials on ending the 17-year war in Afghanistan appear to be gaining momentum.

The leader of the war-torn nation made the remarks as U.S. peace negotiator Zalmay Khalilzad visited Kabul for consultations on his progress in talks with the Taliban.

A month ago, Pakistan assured Khalilzad that it would back a negotiated settlement with the Taliban to end the long war in Afghanistan. U.S. President Donald Trump has personally asked for Islamabad’s help in advancing the Afghan peace process.

Regional powers such as China have also pledged to help Afghanistan and Pakistan overcome their longstanding suspicions about each other.

But political tension between Kabul and Islamabad and allegations thrown back and forth that security agencies in both countries support militant groups launching deadly attacks against one another continue to strain their ties.

In 2017, Pakistan began building a fence on its disputed 2,500 km (1,500 mile) border with Afghanistan to prevent incursions by militants.

Ghani also questioned the religious legitimacy of the Taliban, who have repeatedly refused to hold direct peace talks with the Afghan government.

“If the Afghan government is illegitimate, so where does the Taliban get their legitimacy from?,” he said.

“Islamic scholars in Mecca and Indonesia said that suicide attacks and killing of civilians does not have a legitimacy...so where is the source of Taliban’s legitimacy?,” he asked.

Direct talks between the Afghan government and the Taliban collapsed in 2015, and the Taliban, fighting to drive out international forces and re-establish their version of strict Islamic law, have said they plan to continue negotiating with the U.S. officials on Feb. 25.