Through it all, General Sharif’s public appearances have been less ostentatious than those of some of his predecessors. But at the same time, his face has become ubiquitous on social media, after giving a free hand to the officer commanding the Inter-Services Public Relations office, the military’s media arm, to modernize that service.

The ISPR had long been headed by lower-ranking officers, and it remained decidedly lodged in the analog era. But by this year, the leader of the office, Asim Saleem Bajwa, had been promoted to lieutenant general — a three-star rank normally reserved for corps commanders — and his agency had become an impressively slick machine.

General Bajwa’s Twitter account has more than 1.5 million followers, and the agency’s Facebook account has more than 2.8 million likes. A film division is pumping out offerings for television, as it had long done, but it has added short videos tailored to YouTube-style platforms.

The social media accounts show in daily detail the commander’s movements — visiting the front lines in Waziristan or reviewing troops. Video links showed army units in combat, sometimes the same day it occurred, and troops helping earthquake victims. Professionally produced martyr-style videos show, for instance, a mother mourning a son killed in the field, who returns from the dead to present her with his beret.

The ISPR declined to comment for this article unless a draft of it was submitted to the office for advance review, according to a spokesman for the agency.

The Pakistani news media is clearly reflecting the shift in influence. When Prime Minister Sharif visited Washington on Oct. 22, for instance, the visit did not get nearly the attention of General Sharif’s current five-day visit to Washington.

In recent weeks, General Sharif has seemed less circumspect about the new pecking order. The military press office noted, for instance, that at a meeting of army corps commanders last Tuesday, the general was “concerned” that the civilian government was not doing enough to follow up the military’s success at clearing out the frontier areas with effective governance. The clearly implied scolding sent shock waves through the political establishment, but few dared to criticize the military — something even opposition parties rarely do now.