Bulgaria says it is also investigating after discovering gunman made short visits to several countries in the Balkans.

Ankara has opened an inquiry after it emerged that the man alleged to be the New Zealand mosque attacker visited Turkey twice, according to an official.

A far-right supporter armed with semiautomatic weapons rampaged through two mosques in the city of Christchurch during afternoon prayers on Friday, killing at least 49 Muslim worshippers and wounding dozens others.

A visitor believed to be a 28-year-old Australian – who has been arrested and charged with murder in New Zealand – had visited Turkey and “stayed for a long period in the country”, the Turkish official said without giving dates.

“We think that the suspect could have been to other countries (from Turkey) in Europe, Asia and Africa. We are investigating the suspect’s movements and contacts in the countries,” added the official, speaking on condition of anonymity.

Turkish media reported that a manifesto published online allegedly by the attacker contained specific references to Turkey and ridding the famed Hagia Sophia in Istanbul of its minarets. Now a museum, the building was once a church before being turned into a mosque during the Ottoman empire.

Sofia earlier said it was investigating after discovering that the gunman might have visited Bulgaria in November 2018.

A man believed to be him spent a week in the country supposedly to “visit historical sites and study the history of the Balkan country”, Sotir Tsatsarov, Bulgaria’s chief prosecutor, said.

He said the inquiry would establish if this was “correct or if he had other objectives”.

The same man also made a short visit to the Balkans in December 2016, travelling by bus across Serbia,

Croatia, Montenegro and Bosnia and Herzegovina.

‘Growing hostility’

Turkey’s President Recep Tayyip Erdogan on Friday condemned the deadly attack, saying it illustrated the growing hostility towards Islam “idly” watched by the world.

“With this attack, hostility towards Islam, that the world has been idly watching and even encouraging for some time, has gone beyond individual harassment to reach the level of mass killing,” Erdogan said at the funeral of a former Turkish minister.

“It is clear that the understanding represented by the killer that also targets our country, our people and myself, has started to take over Western societies like a cancer,” Erdogan said.

The Turkish leader, who often criticises Islamophobic attitudes, called for the West to act to prevent similar attacks.

“If measures are not taken right away, news of other disasters will follow this one … I am calling on the world, in particular the West, to take quick measures,” he said.

After Friday prayers, dozens of people gathered outside Istanbul’s Fatih Mosque – one of the city’s main mosques – chanting condemnation of the attack and waving signs saying “Stop global terrorism” and “Crusader Savagery in New Zealand”.

Erdogan had earlier condemned the attack on Twitter: “May Allah have mercy on the victims and grant a speedy recovery to the wounded.”

Speaking in Brussels, Turkey’s Foreign Minister Mevlut Cavusoglu also condemned the killings, blaming “irresponsible politicians who incite hatred against Muslims and propagate xenophobia”.

“There are lessons that everybody needs to learn from this attack, especially in the EU, in the members of the EU,” he said after meeting with European Union officials.

“Hate language used against the Muslims should not be considered as a part of freedom of expression.”