VATICAN CITY — Pope Benedict XVI clearly acknowledged on Tuesday that the need to prevent diseases like AIDS could outweigh the church’s long opposition to the use of condoms.

It was a significant and stunning personal pronouncement from the conservative pope after more than two decades of heated debate inside the Roman Catholic Church and condemnation by health workers who said the church’s ban on prophylactics was morally indefensible during the AIDS crisis.

The Rev. Federico Lombardi, the Vatican’s spokesman, said that for Benedict, the use of condoms by people infected with H.I.V. could be “the first step of responsibility, of taking into consideration the risk to the life of the person with whom there are relations.”

“Whether it’s a man or woman or a transsexual,” he added.

Though Benedict did not endorse the general use of condoms or change official church teaching — which still strongly opposes contraceptives — his words ricocheted around the globe, greeted with anger from some conservative Catholics and enthusiasm from clerics and health workers in Africa, where the AIDS problem is worst. The pope also considers the continent to be a major area of growth for the church.