KABUL, Afghanistan (AP) — Afghanistan's president will make his first visit to Pakistan in more than a year in an effort to mend strained relations between the two countries and in the hopes that he can enlist the support of the new Pakistani government to help end the nearly 12-year Afghan war, an official said Sunday.

The two nations have had tense ties for years, and Afghanistan has accused Pakistan in the past of supporting the Taliban in the movement's fight against the Afghan government. But the election two months ago of a new prime minister in Pakistan has raised hopes in Kabul that Islamabad will be more open to helping start peace talks with the Taliban than the previous government — which it perceived to be more hostile to Afghanistan and its president, Hamid Karzai.

Pakistan is seen as a key player in the Afghan peace process, and the U.S. has been trying to enlist its support to help coax the Taliban into peace talks. Islamabad has ties to the Taliban that date back to the 1990s, and many of the group's leaders are believed to be detained or living on Pakistani territory.

Afghanistan's government recently charged that Pakistan had floated the idea of a power-sharing deal with the Taliban, while Karzai's chief of staff went so far as to suggest that a recently opened Taliban office in the Gulf state of Qatar was a plot by Pakistan or the United States to break up the country. Karzai's government has in the past rejected sharing power with the Taliban.

The Taliban opened the Qatar office in June, but then shuttered it a month later, at least temporarily, after a dispute broke out over their use of the name and flag they had during their five-year rule in Afghanistan. Kabul charged that the office resembled an embassy for a government-in-waiting. It is not clear when, or if, it will reopen.

Afghan Foreign Ministry spokesman Janan Mosazai told reporters that Karzai had accepted an invitation delivered by Pakistan one week ago and that a date for the visit would soon be set. He last visited Pakistan in mid-2011.

"Afghanistan in the past 10 years very honestly tried to strengthen cooperation and relations with Pakistan," Mosazai said. "Afghanistan tried to establish a trust building effort between both countries, unfortunately we didn't get what we expected from the former governments of Pakistan, so we are hopeful that with the establishment of the new government under the leadership of Prime Minister Nawaz Sharif we will be able to open a new page between both countries."

"We don't want this trip to be only a visit, but we want the trip to have good result for both countries," he said.

Mosazai added that the government hoped the new relationship will be "based on mutual respect, honesty and to the benefit of both countries, especially in the struggle and fight against terrorism and extremism in the region."

In an effort to improve frayed ties, the new government in Islamabad sent its special adviser on national security and foreign affairs to Kabul a week ago. Sartaj Aziz brought an invitation for Karzai and said Pakistan was willing to help jumpstart long-stalled peace talks to try to end the war in Afghanistan.

Karzai's office also said Sunday that he met with Gen. Lloyd J Austin, commander of U.S. Central Command, and discussed progress on a drafting a bilateral security agreement with the United States and the progress being made by the Afghan security forces since they took the lead for security around the country last month.

Details of Saturday's unannounced visit were not made public, but Karzai's office said in a statement that they also discussed regional issues. According to the statement, Austin gave assurances that his government will cooperate and assist in the equipping of the Afghan army and air force.

Last week U.S. Gen. Martin Dempsey, chairman of the Joint Chiefs of Staff, said he would like to see a security agreement with Afghanistan signed by October to give NATO enough time to prepare for a post-2014 military presence instead of a total pullout.

A failure to sign a security agreement would mean that no American forces will remain in the country after the end of 2014, when all international combat troops are to leave Afghanistan.

___

Associated Press writer Patrick Quinn contributed from Kabul.