ISTANBUL, Turkey — At the end of his three-day trip to Turkey, Pope Francis met Sunday with a small group of refugees from Syria, Iraq, and other countries of the Middle East and Africa to say he “shares their sufferings.”

The encounter, held in a small chapel in Istanbul just before Francis’ departure for Rome, was defined by the pope as symbol of his outreach to people driven into exile by violence in neighboring Syria and Iraq.

“You represent hundreds of your peers, many of whom are exiles and refugees helped every day by the Salesians,” he said, referring to a religious order founded in Italy in the late 19th century that specializes in work with young people.

“I wish to assure you that I share your sufferings,” he said. “I hope my visit, by the grace of God, may offer you some consolation in your difficult situation.”

When the trip to Turkey was first announced by Francis, on his way back from South Korea in mid-August, he expressed his desire for a visit to the border with Syria as a sign of support to the millions who have abandoned their homes because of ISIS and other armed conflicts in Middle Eastern countries.

“Dear young people, do not be discouraged,” he said. “With the help of God, continue to hope in a better future despite the difficulties and obstacles which you are currently facing,” Francis said.

“Remember always that God does not forget any of his children,” he said, “and that those who are the smallest and who suffer the most are closest to the Father’s heart.”

Because of its geographical position, Turkey is a transition country for millions fleeing war, social instability, and poverty in the Middle East and Africa.

Since the outbreak of violence in Syria in 2011, more than 1 million Syrians have found refuge in Turkey. About 30 percent live in 22 government-run camps near the Syrian-Turkish border, while the rest find a way to make ends meet in communities across the country.

According to the United Nations Refugee Agency, an estimated 200,000 Iraqis also have entered Turkey fleeing the Islamic State since June 2014.

Turkey has accorded temporary protection to Syrians, which precludes forced repatriation, but legally, they are not refugees, but “guests.” Turkey is a signatory to the 1951 UN Convention on Refugees, but because of a geographic exception written into the original document, it is only obligated to accept refugees from European nations.

This exception means that the non-Europeans seeking permanent resettlement must look to a third nation, a process that can take a minimum of two years if, for example, they’re applying for resettlement in the United States.

After praising the “many organizations [that] are doing a great deal for refugees,” Pope Francis promised the constant support of the Church and its charitable organizations.

“Through her social and charitable organizations, the Church will remain at your side and will continue to hold up your cause before the world,” he said.

He also made an appeal to the international community.

“I hope that the necessary support of the international community may not be lacking,” he said.