THE image of a mustachioed man with peaked cap and a chest full of medals is becoming hard to avoid in Pakistan. It is splashed across the posters of a politician competing in a by-election in the eastern city of Lahore. It looms large on giant billboards in the port city of Karachi, apparently paid for by adoring citizens. And it is a rare day when Pakistan’s chief of army staff is not pictured on a newspaper front page. He has even entered the colourful repertoire of artists who decorate the nation’s trucks and rickshaws.

The apotheosis of General Raheel Sharif (pictured, wearing beret) makes it harder than ever for his unrelated namesake, Nawaz Sharif, who is prime minister, to claw back powers from an army that has directly and indirectly controlled Pakistan for most of its history. Nawaz Sharif’s election victory in 2013 resulted in the country’s first transfer of power from one civilian government to another. But the extent of his authority is debatable: the army is reasserting itself.

This marks quite a turnaround for an institution that eight years ago was so unpopular that off-duty soldiers in the most restive areas were advised not to wear their uniforms in public. The long rule of General Pervez Musharraf, a coup-maker, had seriously tarnished the army’s prestige. A particular setback was the violence unleashed in central Islamabad in 2007 when General Musharraf decided to clear out a pro-Taliban mosque in the heart of the city. The army was humiliated in 2011 when the public discovered Osama bin Laden had been hiding next to the country’s officer-training school and that American special forces had been able to penetrate deep into Pakistan to kill him.

Today the army is riding high, buoyed by an improvement in security following a decision in June 2014 to launch an all-out campaign against the Pakistani Taliban. Many credit General Sharif with taking the initiative. Operation Zarb-e-Azb has seen key towns in the former Taliban sanctuary of North Waziristan retaken by the state. Militants have been hunted down elsewhere, particularly in Karachi, which had been a major centre of Taliban activity. All this work has helped cut militant violence by nearly half in the last nine months, according to the Pakistan Institute of Peace Studies, a think-tank in Islamabad.

At the same time the army has been waging a public-relations war, promoting General Sharif as a star. The media dutifully report on his every visit to the front lines and publish photographs of every honour-guard he inspects during his numerous overseas trips.

That General Sharif should receive more than usual publicity is understandable given the country remains mired in a bloody internal conflict. On September 18th 13 Taliban suicide-fighters fought their way into a residential compound of Pakistan’s air force near the city of Peshawar and killed 29 people. Sustaining public support for a war against Islamist militants is tricky given that many on the religious right sympathise with the Taliban’s goal of a strict sharia state and often avoid condemning their means of achieving it.

But the constant boosting of the army has come at the price of undermining Pakistan’s civilian rulers, who come across as petty and ineffectual characters compared with the go-getting General Sharif. Aides to the prime minister have been reduced to pleading with journalists at least to mention him when reporting on events dominated by the army chief. Veterans of Mr Sharif’s faction within the Pakistan Muslim League say it is the latest battle in a decades-old fight for supremacy between generals and civilians.

Mr Sharif’s hopes of using his landslide majority to clip the army’s wings and run his own foreign policy have so far come to nothing. A trade deal with India has foundered because of the army’s opposition and the difficulties of dealing with a hardline government in Delhi. The trial on charges of high treason of General Musharraf, who ousted Mr Sharif in a coup in 1999, has been kicked into the long grass.

Few believe the military men are planning another formal takeover. That would likely trigger international sanctions, which the cash-strapped country can ill afford. The army would have little to gain: it already dominates foreign affairs and defence policy, its biggest preoccupations.

There is much speculation, however, that General Sharif will be given an extension of his three-year term in office. He is due to step down in November 2016. Many clamour for him to stay for at least another term. General Musharraf recently echoed these calls. If he does stay on, it would be a setback for civilian government. (There would be a precedent: Ashfaq Kyani, his predecessor, who was credited with rolling back the army’s involvement in politics under General Musharraf, was given an extension in 2010.)

The aura surrounding the army chief has extinguished what little public scrutiny there was of his institution. Such oversight is badly needed as the army’s power expands. Military courts have started hearing terrorism cases. The army sits on “apex committees” that co-ordinate security matters in each of the four provinces. Through the paramilitary Rangers force it is largely in charge of policing in Karachi.

No one is calling for a drive against the corruption that pervades the army’s vast commercial empire. Nor have questions been asked by Pakistan’s media about how so many gunmen were able to enter the air force camp near Peshawar. General Sharif rushed to the scene and met injured troops. After the attackers were killed his spokesman pronounced the army’s response “a huge success”—another feather in the cap of Pakistan’s strongman.