Robert Nugent, a Catholic priest who became nationally known for his pastoral work with gay men and lesbians, a ministry that was officially ended in 1999 when the Vatican declared it “erroneous and dangerous,” died Jan. 1 at a religious retirement community in Milwaukee. He was 76.

The cause was cancer, said a niece, Kathleen Moran.

By the time of his confrontation with the Holy See, Father Nugent had developed both a community of devoted followers and a collection of angry critics. His admirers revered him for what they regarded as his courageous efforts to open wider the doors of the church, while opponents charged that he had violated Catholic dogma.

According to church doctrine, homosexuality is not sinful, but homosexuals acts are — a stance that has alienated many gay Catholics and others. When he began working with gay Catholics in the early 1970s, Father Nugent said, he was profoundly moved by the experience.

“What I found was people who loved the church very much,” he once said. “It was their family, their home. But they felt like the church didn’t want them. There was a great love-hate relationship.”

In 1977, Father Nugent joined Sister Jeannine Gramick, a Catholic nun, in founding the New Ways Ministry in Mount Rainier, in Washington’s Maryland suburbs. Working through that organization, they launched what might be described as a grass-roots effort to reconcile the gay community and the church.

For two decades, they led workshops, counseling sessions and seminars, and they communicated a theology that was less accusatory and more inclusive than the message traditionally conveyed by Catholic clergy.

The efforts quickly attracted the notice — and steadfast opposition — of many church leaders, including Cardinal James Aloysius Hickey, who as head of the Washington archdiocese oversaw the Prince George’s County ministry.

In 1984, Hickey ordered Father Nugent and Gramick to cease their activities in his jurisdiction. The same year, the Vatican ordered the two to leave New Ways Ministry.

Father Nugent and Gramick continued their ministry elsewhere, and the Catholic hierarchy pursued an investigation that ultimately landed at the Congregation for the Doctrine of the Faith, the Vatican agency whose purpose is to promote and defend Catholic orthodoxy. The congregation was then led by Joseph Ratzinger, the German cardinal who would become Pope Benedict XVI.

In 1999, the congregation found that Father Nugent and Gramick had failed to adhere to Catholic doctrine on “the intrinsic evil of homosexual acts” and, thereby, had “caused confusion among the Catholic people and . . . harmed the community of the church.”

They were banned permanently from pastoral work with gays.

Father Nugent said he had not departed from the church’s teaching but rather had shifted its approach.

“I spent 25 years telling homosexuals that the church cares for you, that it wants you to have a part in it,” he told the Associated Press. “How can I talk to them and convince them of that if I use language like evil, depravity and disorder?”

In 2000, the Vatican ordered Father Nugent and Gramick not to speak about the investigation of their work. Father Nugent obeyed, fearing that doing otherwise would cost him his priesthood. Gramick continued her work.

She visited Father Nugent throughout his fatal illness. He received hundreds of letters, she said, from Catholics thanking him for what he had done.

“It was very painful for him to have people in higher authority call into question his orthodoxy or his pastoral abilities,” she told The Washington Post after his death. “It took a lot out of him.”

Charles Robert Nugent was born July 31, 1937, in Norristown, Pa., the son of a railroad worker and a homemaker. He attended Catholic schools and discovered his vocation at an early age.

“I decided that if I wanted to do something with my life, being a priest was a good way to affect people for the good,” he told The Post in 1999.

He was ordained in Philadelphia in 1965 and joined the Society of the Divine Savior in New Carrollton, Md., in 1977. He received a master’s degree in library science from Pennsylvania’s Villanova University in 1974 and a master’s degree in sacred theology from Yale University in 1983.

Early in his career, he sought out untraditional pastoral assignments — including one at a skid row shelter — despite pressure from church superiors who steered him toward parish work.

“I wanted a ministry that I felt was engaging and satisfying, and I guess more creative,” he told The Post. “I liked parish life, but I felt that I was called to do something else.”

In the early 1970s, while working in Philadelphia, Father Nugent read a newspaper article about Gramick and the ministry she had begun with gay men and lesbians. He sent her a letter expressing his encouragement and extending an offer to help.

To his surprise, and initially to his trepidation, Gramick invited him to celebrate Mass with the group she had convened.

“I grew up with all the fears and anxieties about homosexuality that . . . most Irish Catholics do,” Father Nugent recalled. “I came away really changed by the stories of the people, who spoke of loving the church, wanting to be part of the church and feeling the church didn’t want them [because] they were sick, they were sinful.”

Father Nugent told the The Post that he and Gramick did not respond to queries about their private lives.

“First, it’s a personal question and . . . secondly, it’s a political question,” he said. “If we say we’re homosexual, then a certain number of people would feel disappointed because they want us to be heterosexual, and they might say we are biased in our opinions. If we say we are not, other people would be disappointed and say what do we really know about it, not having experienced it.

“In 25 years, no one has ever implicated us in anything that would be a violation of our vows,” Father Nugent said. “And I think that’s because we’ve kept our personal lives out of it.”

His survivors include a sister.

Speaking with The Post, Father Nugent explained his decision to obey the Vatican’s order.

“I’d be a priest, but I’d be a priest without a parish, a priest without people,” he said. “And I couldn’t survive that way. I’ve been a priest for almost 35 years. I’ve been happy. It’s been wonderful. It’s not a job, it’s not a profession, it’s a way of life. And I wouldn’t trade it for a minute. I think I’d be lost if I weren’t a priest.”