BERLIN — The spoof on a classic German children’s song was intended to poke fun at the generation gap between climate-conscious young Germans and their purportedly gas-guzzling grandparents.

But after one of the nation’s largest public broadcasters posted the song on its Facebook page, some offended grandparents complained. The far right caught on, and its online trolls fomented a controversy to promote their own agenda. The broadcaster took down the item and apologized. Its journalists accused their bosses of caving in and said that they themselves had become targets of death threats.

Those events over the last two weeks in Germany are verging on a national scandal centered on, of all things, a satirical ditty called “Granny Is an Old Environmental Swine.”

Observers note the controversy is similar to others in recent years fanned by a small number of right-wing trolls seeking to disrupt public consensus on the fight against climate change and the country’s mainstream media.