With presidential elections fast approaching in the United States and Europe in the midst of a serious migrant crisis, few topics are more hotly debated today than the question of immigration.

Some are radically opposed, especially when it comes to significant numbers of mostly Muslim migrants, while others advocate an open-door policy in a spirit of solidarity and brotherhood.

In mid-April, Pope Francis visited the Greek island of Lesbos, a symbolic entry point for migrants and refugees wishing to enter Europe, especially those coming from the Middle East. On his return to Rome, he brought back 12 Muslim refugees on the papal plane with him, a gesture that garnered praise from some quarters while provoking consternation in others.

Yet even Pope Francis, who has begged forgiveness from migrants for “our closed-mindedness and indifference” and has declared his solidarity by saying “we are all migrants,” has also begun recognizing limits to the numbers of migrants that can reasonably be integrated into European society.

In an extensive interview with the French Catholic daily La Croix published Tuesday, the pope was asked whether Europe should be accepting so many migrants, to which he replied that “it is a fair and responsible question,” adding that “we cannot open the doors irrationally.”

On Thursday, the pope received a group of new ambassadors representing six different nations from Africa, Northern Europe and Southeast Asia, acknowledging in his address that many people “are afraid of terrorism and of a growing influx of migrants fundamentally changing their culture, economic stability and way of life.”

He further recognized that such fears are understandable and cannot be dismissed lightly, but added that “they must be addressed in an intelligent and creative way, so that the rights and needs of all are respected and upheld.”

Yet rather than read the tea leaves of papal gestures and remarks, many Catholics ask themselves during this stressful period whether there actually is a “Catholic” position regarding immigration, and how they should juggle the widely varied political options on offer.

After all, despite the pope’s notorious comments implying that Donald Trump is not a Christian if he intends to build a border wall with Mexico, there is really nothing in Catholic doctrine against protecting a nation’s sovereign borders. The Vatican’s own border walls were erected by the eminently Christian Pope Leo IV, and later expanded and fortified by Popes Paul III, Pius IV and Urban VIII.

As usual with all questions of Catholic social thought, the Church furnishes general principles and criteria, but then leaves a considerable amount of room for lay Catholics to apply them judiciously to the real situations that face them.

The Catechism of the Catholic Church is terse in dealing with the question of immigration, but provides the fundamental framework for understanding how Christians are asked to view the issue.

In a single number, 2241, the Catechism speaks of the obligation of the more prosperous nations “to welcome the foreigner in search of the security and the means of livelihood which he cannot find in his country of origin,” while also adding the clause “to the extent they are able,” which again suggests the need for prudent discernment.

The same number also notes that political authorities, for the sake of the common good, “may make the exercise of the right to immigrate subject to various juridical conditions.” For their part, the immigrants themselves “are obliged to respect with gratitude the material and spiritual heritage of the country that receives them, to obey its laws and to assist in carrying civic burdens.”

This final condition would seem to suggest that illegal immigration does not fall within the Catholic notion of how migration should be carried out.

The Compendium of Catholic Social Doctrine goes further still, asserting that the regulation of immigration according to criteria of “equity and balance” is not optional, but rather “one of the indispensable conditions for ensuring that immigrants are integrated into society with the guarantees required by recognition of their human dignity.”

The question of how effectively newcomers can integrate into an existing society is at the heart of the Catholic understanding of effective immigration. People coming from a culture with radically different suppositions about the human person and society will clearly have a harder time assimilating into their new home.

On this question, even popes can differ in their evaluation of how likely this integration will be in a given situation.

On Thursday, Pope Francis expressed his belief that it is possible for migrants, who in Europe are mostly Muslims, to be assimilated in a way that “respects the traditions of migrants and preserves the culture of the community receiving them, all the while enriching both.”

Francis has repeatedly cited examples, including that of his native Argentina, where this harmonious coexistence of Muslims and Christians could be found.

In his interview with La Croix, the Pope said that “coexistence among Christians and Muslims is possible. I come from a country where they live together in good familiarity,” adding examples from the Central African Republic and Lebanon.

In this belief, Pope Francis seems to diverge from the opinion of his predecessor Pope Benedict XVI, who once declared that Islam “is not simply a denomination that can be included in the free realm of a pluralistic society” because of its “total organization of life that is completely different from ours.”

All of this should provide some balm to practicing Catholics who have reservations about open borders and wonder whether they are in some way outside the fold.

In the case of immigration, as in so many when moral absolutes are not in play, there is plenty of room for Catholics to exercise their best prudential judgment while adhering to fundamental principles.