ISLAMABAD — Hoping to recast an often strained relationship with a crucial neighbor, President Ashraf Ghani of Afghanistan made his first state visit to Pakistan on Friday.

His two-day visit is to include a meeting with Prime Minister Nawaz Sharif on Saturday, followed by a joint news conference, and he plans to attend a Pakistani-Afghan cricket match.

On Friday, Mr. Ghani held talks with top officials of the Pakistani foreign office and finance ministry in Islamabad, the capital. But his most important meeting was with Gen. Raheel Sharif, the army chief, at the General Headquarters in the nearby garrison city of Rawalpindi.

The Pakistani military said in a statement that Mr. Ghani received a briefing there on the situation along the two countries’ common border, which runs through mountainous tribal areas where militant groups are active. The statement said Mr. Ghani sought stronger security ties, including cooperation in training and border management, and promised his country’s cooperation “to jointly curb the menace of terrorism.”