ISTANBUL — As authorities in New Zealand and companies such as Facebook were furiously scrubbing online footage of a shooting rampage that killed 50 people at two mosques in New Zealand, the same disturbing footage was being shared with thousands of Turkish citizens — by President Recep Tayyip Erdogan.

Erdogan has played blurred clips of the video at campaign rallies in several Turkish cities over the past few days, to fire up his conservative Islamist supporters and attack his political opponents ahead of local elections scheduled for later this month. But his use of the footage drew a rebuke Monday from New Zealand Foreign Minister Winston Peters, who said the dissemination of the video could endanger his country’s citizens.

The alleged shooter, Brenton Tarrant, 28, an Australian citizen, live-streamed the assault on two mosques in Christchurch, authorities said. Peters, speaking to reporters Monday after a weekly cabinet meeting, said he had raised Erdogan’s use of the footage with an official Turkish delegation visiting New Zealand.

Peters said he told Turkish officials “that anything of that nature that misrepresents this country — given that this was a non-New Zealand citizen — imperils the future and safety of the New Zealand people and our people abroad, and it’s totally unfair.”

Tarrant visited Turkey at least twice in the past few years, Turkish officials said. A 74-page manifesto purportedly written by Tarrant and circulated online threatened violence against Turkey, its citizens and its president. Erdogan’s name appears under a section titled, “Kill High Profile Enemies,” along with German Chancellor Angela Merkel and London Mayor Sadiq Khan.

It also warns Turkey’s citizens against living on the European side of Istanbul. “We are coming for Constantinople and we will destroy every mosque and minaret in the city,” it said, referring to the city.

Erdogan has long cast himself as a champion of Muslims living in the West, condemning anti-Muslim racism in Europe while portraying many of Turkey’s squabbles with Western nations as stemming from prejudice.

He has frequently brought those grievances and other populist issues to the forefront during elections. During the current local election campaign, Erdogan and his ruling Justice and Development Party have faced criticism for a sharp downturn in Turkey’s economy.

Erdogan swiftly condemned Friday’s attacks in New Zealand, writing on Twitter that day that the massacre was a “deplorable act — the latest example of rising racism and Islamophobia.” Soon after, he was using the shooting as a cudgel against one of his main political opponents in Turkey.

At Erdogan’s campaign rallies in several cities, a video montage played blurred clips of the shooting, portions of the manifesto and remarks by far-right Australian Sen. Fraser Anning that blamed the massacre on illegal immigration.

“Someone is doing the same from Turkey,” Erdogan said at one of the rallies on Sunday in the city of Antalya. He was referring to comments by Kemal Kilicdaroglu, the head of Turkey’s main opposition party, who said in a recent speech that the Islamic world “needs to sit and think: Why is there terror in my country?”

“Shame on you,” Erdogan said, referring to his opponent.