BAKU, Azerbaijan—In an address in which he seemed to have an eye not only on those physically with him, but those watching from afar, Pope Francis on Sunday warned that the goals of fraternity and the common good cannot be reached through “extreme and radical attitudes which are furthest from the living God.”

“The fraternity and sharing that we seek to increase will not be appreciated by those who want to highlight divisions, reignite tensions and profit from opposition and differences,” Francis said when meeting with Muslim, Orthodox and Jewish leaders in Baku, capital of Azerbaijan.

Fraternity and sharing, the pontiff continued, “are invoked and longed for by those who desire the common good, and are above all pleasing to God.”

The Grand Mufti of the Caucasus region, Allahshukur Pashazadeh, was hosting the encounter with the pontiff in the Heydar Aliyev Mosque, attended also by representatives of the Russian Orthodox Church and the leaders of the local Jewish community.

The Shiite Islam leader praised Francis at several opportunities throughout his remarks, saying that the pope’s actions, both as a head of state and as leader of the world’s Catholics, “generate in us a lively interest.”

“It’s very important to observe your critical approach to the problems that concern the world,” the sheikh said.

Pashazadeh cited “your serious disapproval of the problem of migrants, your protest against connecting Islam to terrorism and, at the same time, your harsh condemnation of the real causes of terrorism, and your incisive speeches against cases of xenophobia.”

Pashazadeh also applauded Francis for his historic recent encounter with Patriarch of Kirill, head of the Russian Orthodox Church, saying it “opened doors” in dialogue. Living in the shadow of Russia, and with an influential though small Orthodox community in Azerbaijan, the Muslim leadership in the country is especially interested in Russian Orthodox affairs.

Sunday marked the first time the pope had visited a nation with a Shiite Muslim majority, and Azerbaijan is considered a close ally of its Shi’a Muslim partner and regional power Iran.

From the beginning, Francis’s weekend trip to Georgia and Azerbaijan had a palpable interreligious and ecumenical undertone.

During the first leg of the foray, the pope received a warm welcome from Patriarch Ilia II, head of the Georgian Orthodox Church. Most of the attention was on the fact that the patriarchate decided not to send an official delegation to the papal Mass, arguing that their church law forbids it.

Yet Ilia went to the airport both to greet Francis on Friday and to wish him farewell on Sunday, and delivered two addresses in his presence, both times acknowledging Francis not only as a head of state but also as a religious leader.

In Azerbaijan, the dialogue wasn’t so much with other Christian communities but with Islam, as it represents close to 96 percent of the population, though after six decades of Soviet rule, for many religious faith and practice is fairly nominal.

On Sunday, in his last event before heading to Rome, Francis said that the leaders meeting one another is a sign which shows that religions can “build together” based on personal relations- something he’s done since his years as Archbishop of Buenos Aires, in Argentina- and on “the good will of those responsible.”

Francis quoted Azeri poet Nizami Ganjavi: “If you are human, mix with humans, because people go well with each other.”

Religions, he said, have an enormous task: “To accompany men and women looking for the meaning of life, helping them to understand that the limited capacities of the human being and the goods of this world must never become absolute.”

Religious leaders, on the other hand, have the responsibility of giving responses to men and women who are searching for God.

Today, he said, there are two tendencies: One is the “dominance of nihilism” of those who believe in nothing other than profit and their own well-being, who throw life away, concluding, as Fyódor Dostoyevski wrote in The Brothers Karamazov, “if God does not exist, then everything is permissible.”

The second tendency is a growing emergence of “rigid and fundamentalist reactions on the part of those who, through violent words and deeds, seek to impose extreme and radical attitudes which are furthest from the living God.”

Religions don’t fall under either. On the contrary, they are called to build a “culture of encounter and peace,” including “humble, tangible steps” to serve the common good.

Humanity, on the other hand, has the challenge of overcoming the temptation of instrumentalizing religion, by expecting it to lend support to conflicts and disagreements.

Talking about religious dialogue, he said that it’s not a “facile syncretism” nor a “diplomatic openness which says yes to everything in order to avoid problems,” but “a path of dialogue with others and prayer for all,” what the pope called a “respectful alliance.”

In a largely Muslim nation in which religious freedom is enshrined in the constitution but sometimes limited in practice, for example by threats of social ostracism and even violence against converts from Islam, Francis on Sunday insisted that “effective and authentic freedom must be guaranteed.”

Dialogue and prayer, he continued, are the roads to everlasting peace, founded on mutual respect, “on the will to go beyond prejudices and past wrongs, on the rejection of double standards and self-interests.”

“Today we’re challenged to give a response that can no longer be put off: to build together a future of peace,” because God and history itself “will ask us if we have spent ourselves pursuing peace.”

Francis called on religions to be “active agents working to overcome the tragedies of the past and the tensions of the present.”

After this encounter and a brief concluding ceremony at Baku’s airport, Francis was scheduled to fly back to Rome. As is by now customary, the pontiff is expected to conduct an in-flight news conference during the journey home.