Pakistan and Afghanistan have a historic opportunity to reset long-fraught ties following the election of democratic governments in both countries, the United States’ top diplomat in Islamabad said Wednesday.

Speaking ahead of newly-elected Afghan President Ashraf Ghani’s first official visit to Islamabad this weekend, Richard Olson praised confidence building measures by both sides including a Pakistan army operation in a Taliban stronghold along the countries’ shared border.

“I think there is quite genuinely a basis for a new relationship between Afghanistan and Pakistan. Both sides are aware of this historical moment and making efforts to seize it,” he said in a speech at the National University of Sciences and Technology in Islamabad.

“Also I would say the actions of the Pakistani army in clearing the North Waziristan agency I think is a very important step in all of this,” he added, referring to the military offensive which began in June.

Pakistan was one of three countries to recognise the hardline Taliban regime that ruled Kabul from 1996 until 2001 when it was deposed by a US-led international military coalition.

The government of former Afghan president Hamid Karzai routinely accused Pakistan of continuing to aid the Taliban in their insurgency in order to destabilise his country, a charge Islamabad denies.

Tensions are also often stoked by cross-border shelling, but Olson praised Pakistan’s recent “restraint” and its efforts to secure the border during the Afghan elections.

In an interview with a foreign news agency in April, Ghani said rapprochement with Pakistan — along the lines of France and Germany after World War II — would be key to ending instability in his conflict-torn nation.

Ghani was sworn into office in September while his main rival Abdullah Abdullah became the country’s CEO, ending a protracted election process marred by fraud allegations.

Pakistan’s Prime Minister Nawaz Sharif won power in last year’s general elections that marked the country’s first ever democratic transition, but has since seen his mandate challenged by opposition groups who allege vote rigging.

A protest movement outside parliament that began in August triggered fears the military could intervene as it has in the past, a move Olson said the US would not back.

“We’re supporters of the rule of law, democracy and the constitution and oppose any kind of extra-constitutional action,” he said.