KABUL, Afghanistan — Flattery of the American president may work in North Korea and Washington, but in Afghanistan it is proving dangerous and even fatal.

An Afghan man who admired the president so much that he legally named his son Donald Trump has now said he no longer feels safe and has fled Afghanistan.

That came three days after another Afghan who helped organize the minting of a gold medal thanking President Trump for his support of Afghanistan was killed by the Taliban, according to police officials in Logar Province and to the insurgents themselves. A third Afghan, also involved in making the medal, said he, too, would flee the country because he no longer felt safe.

Zabihullah Mujahid, the spokesman for the Taliban, said in a statement on WhatsApp that the insurgents were responsible for the killing of Gul Nabi in Pul-e-Alam, the capital of Logar Province, in revenge for his “criminal” role in making the medal. Shapoor Ahmadzai, a spokesman for the Logar Provincial Police, said Mr. Nabi, a prominent tribal elder in the province, had been killed by a bomb attached to the underside of his car last Friday.