Recep Tayyip Erdogan, Turkey’s president, has sparked a diplomatic confrontation with Australia and New Zealand over the Christchurch massacre by threatening that anti-Muslim Westerners would be sent home “in coffins” like those killed the Battle of Gallipoli.

The Turkish leader has made the killings in New Zealand a centre-piece of his political campaign ahead of local elections at the end of the month and has been playing footage of the mass killing before crowds at his rallies.

In a speech near the site where thousands of New Zealander and Australian troops were buried after the 1915 Battle of Gallipoli, Mr Erdogan said the Christchurch shooter and the First World War soldiers were both motivated by anti-Islamic sentiments.

“Your grandfathers came and saw that we're here. Then some of them walked back, while others left in coffins,” Mr Erdogan said. “If you come with the same intention, we'll be waiting for you.”

His comments were met with fury in Australia, where Scott Morrison, the prime minister, summoned Turkey’s ambassador and demanded that Mr Erdogan retract his remarks.

“Remarks have been made by the Turkish President Erdogan that I consider highly offensive to Australians, and highly reckless in this very sensitive environment,” Mr Morrison said.