Pope Francis has called for more religious tolerance and for fundamentalism to be tackled by relieving hunger, poverty and marginalisation, rather than by military interventions alone.

Speaking in the vast auditorium of Turkish president Recep Tayyip Erdoğan’s palace in Ankara, he lauded Turkey for hosting large numbers of Syrian refugees, and reminded the international community of their “moral obligation” to help care for the almost 2 million Syrians currently living within Turkish borders.

The fourth pope to visit the largely Muslim country, Francis highlighted his commitment to dialogue with Muslims and other Christians at a time of increased violence against Christian and other minorities in the region, especially in Turkey’s neighbours Syria and Iraq, where Islamic State (Isis) militants have brutally persecuted Yazidis, Shia Muslims, Christians and others who do not agree with their radical interpretation of Sunni Islam. Many of the Iraqi and Syrian Christians who have fled their homes to escape the spread of Isis are currently living as refugees in Turkey.

Speaking at a joint press conference with Erdoğan, the pontiff underlined that it was “licit, while always respecting international law, to stop an unjust aggressor”, but added that military intervention would not bring sustainable peace to the region.

“What is required is a concerted commitment on the part of all, based on mutual trust, which can pave the way to lasting peace, and enable resources to be directed, not to weaponry, but to the other noble battles worthy of man: the fight against hunger and sickness, the promotion of sustainable development and the protection of creation, and the relief of the many forms of poverty and marginalisation, of which there is no shortage in the world today,” the pope said.

The 77-year-old Argentinian pontiff, leader of the world’s 1.2 billion Roman Catholics, delivered his address from the lavish new presidential palace, one of the most controversial building projects in modern Turkey. The complex covers 200,000 sq metres (2.1m sq feet) and has 1,000 rooms. The cost of the project ran to 1.37bn Turkish lira (£385m).

Erdoğan, fourth right, and Pope Francis, fourth left, at the new 1,000-room presidential palace. Photograph: AP

Francis – who has made austerity a trademark of his papacy – refuses to live in the apostolic palace in the Vatican City, preferring a modest guesthouse where he eats with other residents.

Alongside Erdoğan, the pope called for more religious tolerance and the right to freedom of expression. Critics have said that these traits are scarce in increasingly authoritarian Turkey, where 99% of the population are Muslim.

“It is essential that all citizens – Muslim, Jewish and Christian – both in the provision and practice of the law, enjoy the same rights and respect the same duties,” Francis said. “Freedom of religion and freedom of expression, when truly guaranteed to each person, will help friendship to flourish and thus become an eloquent sign of peace.”

While stressing that he and his papal visitor “agreed on most things”, Erdogan criticised “Islamophobia and racism in the west”. Arguing that terrorist organisations such as Isis, Boko Haram and al-Qaida were able to rally people to their cause due to international policy failures, he expressed dismay about the “world’s double standards” regarding the crimes of Syrian president Bashar al-Assad, Israel and the outlawed Kurdistan Workers’ party (PKK), which has recently made headlines fighting an Islamic State attack in the Syrian town of Kobani.

The pope repeated his call for tolerance when speaking at Turkey’s directorate for religious affairs, or Diyanet, in a joint meeting with Mehmet Görmez, the country’s most senior cleric.

Görmez agreed, underlining that Islam was “a religion of peace”: “Those who speak on behalf of God, such as fundamentalists, are part of the problem,” he said, adding that terrorism was “a rebellion against God, and as Muslims we reject this extremism and bloodshed”.

Pope Francis will travel to Istanbul on Saturday where he will meet the ecumenical patriarch, Bartholomew I, the pre-eminent spiritual leader of the world’s 300 million Orthodox Christians.