Hamid Karzai, the Afghan president, flew into Islamabad after an 18-month hiatus, the longest during his presidency and only thanks to intense behind-the-scenes diplomacy and nudges from US, the UK and the UN.

In the end, the visit was only sealed after the Pakistan prime minister, Nawaz Sharif, sent a close adviser to Kabul with a personal invitation.

Two crucial issues have been on the agenda:

Peace and security - Nato forces are already planning to exit Afghanistan at the end of next year, and the new Afghan National Army will have to take a lead role against a determined Afghan Taliban.

Elections - Presidential and parliamentary polls are planned next year in Afghanistan ahead of the Nato withdrawal.

Both issues will determine the future shape of things to come in a country that has been in a state of war for decades.

Even though Karzai is unlikely to run for a third term, his visit to Pakistan is of vital importance in putting relations back on an even keel. 

Karzai flew in to Islamabad without many expectations but the reception he received from Sharif was enough to convince him to extend his trip.

The Afghans are keen for Pakistan to use its influence over the Afghan Taliban to bring them to the table for direct talks with Afghan authorities.

Pakistan reassured Karzai it do its best to support the Afghans, although it did not give any timeline on the release of key Taliban leaders under its custody  - including the senior Taliban commander Mullah Abdul Ghani Barader, who was arrested in 2010. 

While the Afghans are eager to get Pakistan's help in kick starting talks with the Taliban, Pakistan was equally eager to forge stronger economic ties with a country that is the  3rd largest market for Pakistani goods. Pakistan also offered to lift restrictions on Afghan goods bound for India and asked for favourable terms for Pakistan goods passing through Afghanistan for central Asia.

Even though both sides were determined to turn a new page in their relations there were plenty of problems and challenges ahead in a mercurial relationship sometimes marred by mistrust.