Ukraine’s security services seized the world’s attention this week by faking the murder of a Russian opposition journalist, Arkady Babchenko, as part of a purported sting operation. At the same time, another plot unfolded in the corridors of government: Oleksandr Danyliuk, Ukraine’s well-regarded finance minister, is being forced to resign, The Economist has learned.

Mr Danyliuk, an independent-minded reformer backed by the International Monetary Fund (IMF), has been under pressure from the country’s leadership before, as he pushed through fiscal reforms. Despite resistance, he has had successes: for instance, he helped secure an order in the London High Court to freeze $2.5bn worth of assets belonging to Ihor Kolomoysky, one of Ukraine’s most notorious oligarchs. But Mr Danyliuk had to act by stealth, and while working on the nationalisation of PrivatBank, brought to insolvency by Mr Kolomoysky, he had to move his family to a secret location for safety.

The latest fight unfolded over Mr Danyliuk’s attempt to get a grip over the country’s fiscal and customs services, two of the most corrupt institutions in the country. Mr Danyliuk, who has been subjected to a smear campaign at home, says he is now being forced to resign. His formal sacking, however, would probably cause a strong reaction among foreign donors, who are watching his case as part of a broader fight between an entrenched elite and a few reformers and young lawmakers who try to transform the country.

Mr Danyliuk is not the only one to have come under attack. So has Ukraine’s National Anti-Corruption Bureau (NABU), an investigative body set up in the wake of the 2014 Maidan revolution with the support of Western governments. Both Mr Danyliuk and Artem Sytnik, the head of the bureau, have irked Petro Poroshenko, the president, and his allies by demonstrating their independence. In November 2017, Yury Lutsenko, Ukraine’s controversial prosecutor-general and a close ally of Mr Poroshenko, in effect sabotaged a high-profile investigation by NABU by detaining seven of its undercover agents. The past record of Ukrainian law-enforcement agencies helps explain why the bizarre episode with Mr Babchenko, the reincarnated journalist, raised so many questions.

On May 29th, Ukrainian authorities reported that Mr Babchenko, a frequent Kremlin critic who had fled to live in Kiev, had been shot and killed outside his apartment there. A photo of Mr Babchenko face down in a pool of blood circulated on social media, three bullet holes seemingly visible in his back. Taking the state’s official statements at face value, friends and colleagues recoiled in shock, and news of his death filled the airwaves.

The next day, at a press conference about the investigation, Ukraine’s security services revealed the plot twist: Mr Babchenko himself, very much alive and smirking at his apparent resurrection. Mr Lutsenko explained that the staged murder had been part of an elaborate plan to catch those who ordered and carried out the hit. “Special apologies to my wife, “said Mr Babchenko, “Olechka, I am sorry, but there were no other options.”

Yet whatever Ukraine gained operationally, it lost in terms of credibility. Though the plot to assassinate Mr Babchenko may well have been real—several other Kremlin critics have been murdered in Kiev and elsewhere in recent years—many wondered whether the Ukrainian authorities could have prevented it without resorting to a fake operation worthy of the Kremlin’s tactics. Ukraine is still trying to defend itself against Russia’s real aggression in the east of the country and Western governments are trying to support it while fending off Russia’s disinformation and subversion. So the actions of Ukraine’s security services and its government play straight into the Kremlin’s hands. And with guns rumbling again in eastern Ukraine, the government could hardly have picked a worse time to raise questions about its trustworthiness. With friends like this, Ukraine needs no enemies.

Clarification (June 4th 2018): The rubric on this article was amended to make it clear that Mr Danyliuk feels he is being pressured to resign, not that he has already resigned