Updated

Afghan President Ashraf Ghani this week will make his first state visit to neighboring Pakistan, long blamed by his predecessor for harboring militants, in hopes of finding a way to revive peace talks with the Taliban.

Mutual suspicion still haunts the two countries' relations — and cross-border shelling is common. But Ghani's third trip abroad after recently visiting Saudi Arabia and China appears part of his plan to recalibrate Afghanistan's relations with its neighbor as others pressure it over the militants hiding within its borders.

Islamabad recognized the Taliban when it was in power in Afghanistan and its leadership fled to Pakistan after the U.S.-led invasion in 2001. Since then, Taliban fighters and other militants have used Pakistan's tribal regions as a base for attacks targeting Afghan and NATO forces. Pakistan's government denies providing support to Taliban fighters and other militants, though many allege the country uses the extremists covertly against its neighbors.

Former Afghan President Hamid Karzai repeatedly accused Pakistan of using the extremists to pursue own its objectives in Afghanistan. But now, analysts, diplomats and others say Ghani recognizes the need for a good relationship with Islamabad.

"If Afghanistan can negotiate directly with the regional partners — and Pakistan can be separated from the terrorists — then the traditional Taliban could become legitimate players," political analyst Haroun Mir said.

In Beijing last month, Ghani called on the Taliban to "join an inter-Afghan peace dialogue," saying "peace is our highest priority." Unless the violence stops, Afghanistan also will not be able to attract the foreign investment needed for its post-war reconstruction.

Pakistani officials in recent weeks have visited Kabul, including national security and foreign affairs adviser Sartaj Aziz, Army chief of staff Gen. Raheel Sharif and the new head of the Inter-Services Intelligence agency Lt. Gen. Rizwan Akhtar.

"The message from Pakistan is very clear: Pakistan's political leadership and military establishment are on the same page, they want a stable Afghanistan," Pakistani defense analyst Talat Masood said.

Ghani inherited a series of challenges when he was inaugurated in September, including a shrinking economy, endemic corruption and, as U.S. and NATO combat troops withdraw at the end of the year, a still-virulent insurgency. Ghani's ambition for a regional trade bloc is backed by Indian Prime Minister Narendra Modi, who has also criticized Pakistan over its alleged support for extremists.

Meanwhile, Iran, bordering Afghanistan's western flank, is being squeezed by Western sanctions, weakening its resolve to support insurgents in Afghanistan, said a Western diplomat who spoke on condition of anonymity because he wasn't authorized to talk to media.

"For Iran, it's a question of balance. For India, it's a question of how close India can become to Afghanistan before it becomes a threat to Pakistan; the answer is, not much. Both countries are in the mood to have Pakistan reconsider its policies in the region," the diplomat said.

___

Associated Press writer Munir Ahmed in Islamabad contributed to this report.

___

Follow Lynne O'Donnell on Twitter at www.twitter.com/lynnekodonnell.