Just to add to my previous post, St. John Paul II explained this in detail in the following allocution, citing both the Fourth Lateran Council and Boniface VIII, as well as a similar statement from the Council of Florence and St. Cyprian:
[quote=St. John Paul II]However, as I wrote in the Encyclical Redemptoris Missio, the gift of salvation cannot be limited “to those who explicitly believe in Christ and have entered the Church. Since salvation is offered to all, it must be made concretely available to all.” And, in admitting that it is concretely impossible for many people to have access to the Gospel message, I added: “Many people do not have the opportunity to come to know or accept the Gospel revelation or to enter the Church. The social and cultural conditions in which they live do not permit this, and frequently they have been brought up in other religious traditions” (RM 10).
We must acknowledge that, as far as human beings can know and foresee, this practical impossibility would seem destined to last a long time, perhaps until the work of evangelization is finally completed. Jesus himself warned that only the Father knows “the exact time” set by him for the establishment of his kingdom in the world (cf. Acts 1:7).
What I have said above, however, does not justify the relativistic position of those who maintain that a way of salvation can be found in any religion, even independently of faith in Christ the Redeemer, and that interreligious dialogue must be based on this ambiguous idea. That solution to the problem of the salvation of those who do not profess the Christian creed is not in conformity with the Gospel. Rather, we must maintain that the way of salvation always passes through Christ, and therefore the Church and her missionaries have the task of making him known and loved in every time, place and culture. Apart from Christ “there is no salvation.” As Peter proclaimed before the Sanhedrin at the very start of the apostolic preaching: “There is no other name in the whole world given to men by which we are to be saved” (Acts 4:12).
For those too who through no fault of their own do not know Christ and are not recognized as Christians, the divine plan has provided a way of salvation. As we read in the Council’s Decree Ad Gentes, we believe that “God in ways known to himself can lead those inculpably ignorant of the Gospel” to the faith necessary for salvation (AG 7). Certainly, the condition “inculpably ignorant” cannot be verified nor weighed by human evaluation, but must be left to the divine judgment alone. For this reason, the Council states in the Constitution Gaudium et Spes that in the heart of every man of good will, “Grace works in an unseen way… The Holy Spirit in a manner known only to God offers to every man the possibility of being associated with this paschal mystery” (GS 22).
It is important to stress that the way of salvation taken by those who do not know the Gospel is not a way apart from Christ and the Church. The universal salvific will is linked to the one mediation of Christ. “God our Savior…wants all men to be saved and come to know the truth. And the truth is this: God is one. One also is the mediator between God and men, the man Christ Jesus, who gave himself as a ransom for all” (1 Tim 2:3-6). Peter proclaimed this when he said: “There is no salvation in anyone else” and called Jesus the “cornerstone” (Acts 4:11-12), emphasizing Christ’s necessary role at the basis of the Church.
This affirmation of the Savior’s “uniqueness” derives from the Lord’s own words. He stated that he came “to give his own life in ransom for the many” (Mk 10:45), that is, for humanity, as St. Paul explains when he writes: “One died for all” (2 Cor 5:14; cf. Rom 5:18). Christ won universal salvation with the gift of his own life. No other mediator has been established by God as Savior. The unique value of the sacrifice of the cross must always be acknowledged in the destiny of every man.
Since Christ brings about salvation through his Mystical Body, which is the Church, the way of salvation is connected essentially with the Church. The axiom extra ecclesiam nulla salus"–“outside the Church there is no salvation”–stated by St. Cyprian (Epist. 73, 21; PL 1123 AB), belongs to the Christian tradition. It was included in the Fourth Lateran Council (DS 802), in the Bull Unam Sanctam of Boniface VIII (DS 870) and the Council of Florence (Decretum pro Jacobitis, DS 1351). The axiom means that for those who are not ignorant of the fact that the Church has been established as necessary by God through Jesus Christ, there is an obligation to enter the Church and remain in her in order to attain salvation (cf. LG 14). For those, however, who have not received the Gospel proclamation, as I wrote in the Encyclical Redemptoris Missio, salvation is accessible in mysterious ways, inasmuch as divine grace is granted to them by virtue of Christ’s redeeming sacrifice, without external membership in the Church, but nonetheless always in relation to her (cf. RM 10). It is a mysterious relationship. It is mysterious for those who receive the grace, because they do not know the Church and sometimes even outwardly reject her. It is also mysterious in itself, because it is linked to the saving mystery of grace, which includes an essential reference to the Church the Savior founded.
In order to take effect, saving grace requires acceptance, cooperation, a yes to the divine gift. This acceptance is, at least implicitly, oriented to Christ and the Church. Thus it can also be said that sine ecclesia nulla salus–“without the Church there is no salvation.” Belonging to the Church, the Mystical Body of Christ, however implicitly and indeed mysteriously, is an essential condition for salvation.