In this May 13, 2013, photo, incoming prime minister and leader of Pakistan Muslim League-N party, Nawaz Sharif, gestures while speaking to members of the media at his residence in Lahore, Pakistan. (K.M. Chaudary/AP)

Gen. Ashfaq Kayani, who heads Pakistan’s powerful army and holds significant sway over civilian affairs, visited the incoming prime minister Saturday in what the military described as a show of support for stronger democracy and greater stability as the nation struggles with an economic meltdown and continued insurgent attacks.

Kayani met for more than three hours with Nawaz Sharif, the ­center-right conservative poised to take over as prime minister for an unprecedented third stint after securing a heavy mandate in May 11 parliamentary elections.

Both sides described the Lahore meeting as informal and cordial, but it was no mere social call. Analysts saw greater import: Kayani visited Sharif even before the prime-minister-in-waiting has been formally elected by Parliament and taken the oath of office.

The military said no other army chief had ever done that, but then Pakistan is entering a period of firsts — most significantly, a historic transition between elected governments.

“There are no rules for this because it’s never happened before,” Shuja Nawaz, who directs the South Asia Center at the Atlantic Council, said Sunday. “This will help the incoming administration get out of the blocks faster than expected.”

Nawaz’s party, the Pakistan Muslim League-N, characterized the meeting as a briefing on security matters and a “good omen for democracy.” The army agreed.

“It shows there is no threat to democracy and no tension between military and civilian leadership,” a ranking military official, who declined to be identified because he is not an authorized spokesman, said Sunday. “Both want to work and support each other for strengthening democracy and addressing the grave problems of militancy and terrorism.”

Concerns, common ground

Sharif, deposed in a bloodless coup 14 years ago, imprisoned and then exiled for years, made a remarkable comeback in a campaign that, although heavily focused on promises of rescuing the economy, included pledges to pull Pakistan out of the U.S. war on Islamist extremism, negotiate with domestic insurgents and promote civilian supremacy over national security matters and foreign affairs.

That political rhetoric raised concern in a country where the military establishment pulls the strings even when not officially in power, as it has been for more than half of Pakistan’s existence. Elected leaders cautiously stay within the strictures placed upon them by the military chiefs and the Inter-Services Intelligence spy agency.

The country’s pundits and political leaders have been hanging on the question of how much room the army will give Sharif to make decisions after he easily locked down enough seats to head the new government.

“The meeting has set a new trend, as army chiefs in the past considered themselves too big and too powerful to call on political leaders,” said Shaheen Sehbai, an editor with the daily News International. “Kayani has again shown that the army under him is trying to support democracy.”

The army considers itself the final arbiter on foreign policy, especially regarding the flash point of Kashmir — the disputed Himalayan territory over which Pakistan and India have gone to war three times — and internal and external security matters, including its sometimes-strained relationship with the United States and NATO.

Sharif and Kayani are thought to share common ground in wanting improved diplomatic and trade relations with India, as a way to help improve the economy. Pakistani businesses are crippled by energy shortages and inflation. The public widely repudiated the economic policies of the last government, led by the Pakistan People’s Party, by ushering in Sharif’s opposition PML-N party.

Many business leaders backed Sharif, a private-enterprise advocate and wealthy industrialist, hoping to improve Pakistan’s fortunes at a time when international investors are beating a retreat. The military, which has a vast network of corporate enterprises, also wants to see a better business climate.

The generals have been willing to cede some decision-making to civilian officials, in appearance at least, because the military needs public support to continue spending a huge portion of the national treasury. By easily securing a majority in Parliament, Sharif became a force to be reckoned with.

“I see Sharif as rather strong at the moment,” said Shaun Gregory, who directs the Pakistan Security Research Unit at Durham University in the United Kingdom.

Within the military leadership, he added, “I do not think there is much stomach at the moment to oppose Sharif.”

But were Sharif to overstep his bounds and, say, get too chummy with India or offer concessions to the Pakistani Taliban — which has killed thousands of civilians, soldiers and officers in its rebellion against the state — he would risk a destabilizing face-off with the military, some close to the armed forces say.

‘Good for democracy’

Kayani, who has run the army since 2007, visited Sharif for lunch at the home of his brother, Shahbaz Sharif, a longtime PML-N leader in Punjab province, the brothers’ power base. Some local media accounts said Shahbaz Sharif appears to be taking on the role of his brother’s military liaison.

The army chief reportedly arrived by private car, but news of the visit was widely leaked, with both sides spinning the unofficial summit as “good for democracy,” as the senior military official put it.

The meeting also comes amid speculation about who will replace Kayani when a new army chief is selected in November. The decision rests with the prime minister.

In a previous stint as prime minister, Sharif skipped over the next general in line to select Gen. Pervez Musharraf as chief of army staff in 1998. It was a fateful decision: Musharraf overthrew Sharif in 1999. Today Musharraf is under house arrest in Islamabad in connection with crimes he is alleged to have committed during his nine-year rule.

Sharif was known during his earlier stints in power as impetuous, arrogant and unwilling to take advice. But many observers say he has mellowed and is more open to compromise, especially with as powerful a man as Kayani.

“Nawaz Sharif is not a confrontational type,” said Shuja Nawaz, the Atlantic Council expert. “He may have disagreements with the military, but he is not going to provoke a confrontation.”

Of the Saturday meeting, he said, “The fact that Nawaz Sharif and Kayani have reached out to each other is a good sign. One should not read too much into it, but the fact that they’re talking is a good beginning.”