Pope Paul VI
Sacerdotalis Caelibatus §84
Sacerdotalis Caelibatus: On the Celibacy of the Priest
84 The Church is very conscious of the sad state of these sons of hers and judges it necessary to make every effort to avert or to remedy the wounds she suffers by their defection. Following the example of Our immediate predecessors, We also have, in cases concerning ordination to the priesthood, been prepared to allow inquiry to extend beyond the provisions of the present canon law (l36) to other very grave reasons which give ground for really solid doubts regarding the full freedom and responsibility of the candidate for the priesthood and his fitness for the priestly state. This has been done to free those who, on careful judicial consideration of their case, are seen to be really unsuited.
Source: Sacerdotalis Caelibatus (Vatican.va)