By Scott Malone

PHILADELPHIA (Reuters) - Pope Francis waited until his historic U.S. visit was over to make his most direct comments on the nation's debate over gay marriage, saying government officials should have the right to refrain from actions that violate their religious beliefs.

That statement came in response to a reporter's question on the papal plane about Kim Davis, the Kentucky county clerk who was jailed earlier this month for refusing to grant marriage licenses to same-sex couples despite a recent U.S. Supreme Court decision that legalized gay marriage in all 50 states.

"Conscientious objection must enter into every juridical structure because it is a right," Francis told reporters, speaking in Italian. "If someone does not allow others to be a conscientious objector, he denies a right."

Francis alluded to the Roman Catholic Church's objections to gay marriage during some of his U.S. talks, citing concerns about "juridical" changes to the definition of the family. Still, he largely avoided the issue, the subject of intense debate.

"He wanted to be bridge-building and not divisive, and that's one of the most polarizing issues in contemporary American society," said Boston College theology professor Stephen Pope.

The pope had been expected to deliver an address Saturday night on religious freedom, which Davis' backers, including Republican presidential candidate Mike Huckabee, have said is a key issue in her fight. But Francis changed course, abandoning prepared remarks and instead speaking about love and the importance of families.

FIGHT FOR LGBT RIGHTS

That speech came hours after Philadelphia Mayor Michael Nutter defended gay, lesbian, bisexual and transgender rights in comments on the steps of Independence Hall ahead of another papal address.

"In America, everyone has rights," said Nutter, a former altar boy. "Our gay, lesbian, bisexual and transgender neighbors continue to fight for their rights."

He cited a response Francis gave to a question about gay rights early in his papacy: "If a person is gay and seeks God and has good will, who am I to judge him?"

Story continues

"Who are any of us to judge the lives of others?" Nutter said. "The scripture tells us judge not, lest you be judged."

While Francis has brought a humble, nonjudgmental approach to his office, he has not changed Catholic dogma, which holds that homosexual activity, extramarital sex and abortion are sinful.

Even as his change in tone has raised Francis' popularity among liberal-leaning Catholics, his de-emphasis of the Church's opposition to gay marriage and abortion in favor of calls for action on climate change and criticism of the excesses of capitalism has lowered his approval among conservatives, polls show.

Papal spokesman Federico Lombardi told reporters shortly before his departure on Sunday that the pope had not commented extensively on gay marriage during his visit because his views on the subject were obvious.

"He comes here hoping to deliver a positive message," Lombardi said. "He does not want, I think, to get into polemics or discussion because he comes for a positive message."

Bill Donohue, of the conservative-leaning Catholic League, said he believed that however guarded, Francis' message of the Church's continued opposition to gay marriage and abortion was clear to devoted Catholics.

"He didn't want to use divisive language ... but at the same time it was pretty clear that he was denouncing radical Islam, that he was denouncing same-sex marriage," Donahue said. "He was very clear on abortion. I don't think anyone failed to hear what he was talking about."

(Reporting by Scott Malone; Editing by Lisa Von Ahn)