To millions of Japanese, the Shinto faith is not so much a spiritual practice as a cultural one. Every January, crowds gather at shrines to pray for good fortune for the new year. Families take their children to celebrate rites of passage, and many seek blessings for luck in romance, school entrance exams or job interviews.

Few regard these rituals as being tethered to any fixed doctrine — Shintoism, an indigenous religion, has no official dogma or scripture. But unbeknown to most in largely secular Japan, a national Shinto association has tried to spread a conservative ideological message among lawmakers, including on gay and transgender rights.

Japan is the only nation in the Group of 7 that has not legalized same-sex unions, and foreign ambassadors have pushed the country to support equality more forcefully in the run-up to a summit in Hiroshima starting later this week. Polls show overwhelming support for same-sex marriage in Japan; one of the country’s most influential business leaders recently called it “embarrassing” that Japan has not sanctioned the unions.

Lawmakers, under pressure from the Shinto group and other traditionalist forces, have lagged behind public opinion, struggling to agree on even limited expressions of support for the rights of gay and transgender people.

Last summer, the Shinto organization distributed a 94-page pamphlet at a large meeting for affiliated members of Parliament, mostly from the governing Liberal Democratic Party, that included a transcript of a lecture describing homosexuality as “an acquired mental disorder, an addiction” that could be fixed with “restorative therapy.”

Another transcribed lecture opposed passage of an L.G.B.T.Q. rights bill, claiming that “there is no systemic discrimination” in Japan and warning that “left-wing activists will use this as their weapon” and that there would be “an outburst of lawsuits.”

This week, a Liberal Democratic parliamentary committee approved a modestly worded bill stating that there “should be no unfair discrimination” against L.G.B.T.Q. people. Activists and opposition party leaders say the bill, which may come before the full Parliament as the G7 convenes, is weaker than one that failed two years ago.

Scholars say that behind-the-scenes efforts by the Shinto group — the Shinto Association of Spiritual Leadership, the political arm of an organization that oversees 80,000 shrines — are one reason for the disconnect between the broader society and the political sphere.

Many shrine workers and visitors may not necessarily know of, or agree with, the Shinto association’s efforts to influence government policy.

But conservatives in the governing party “really rely on the religious right for their election campaigns,” said Kazuyoshi Kawasaka, a lecturer in modern Japanese studies at Heinrich Heine University in Düsseldorf, Germany. The influence of such groups “is much more important than the public supporting same-sex marriage,” Mr. Kawasaka said.

Naofumi Ogawa, a lawyer for the Shinto group, said in an email that the pamphlet does “not directly represent the views of the organization.”

But the group has posted documents on its own website describing calls “for an excessive protection of rights” or for legalizing same-sex marriage as “movements to dismantle the family structure.”

During an interview with foreign media last month, Prime Minister Fumio Kishida explained why Japan had not yet legalized same-sex marriage. “The situation surrounding each country is different,” he said in a prepared answer to a question from The New York Times. “Careful, thorough discussion is needed.”

The influence of the religious right on conservative politicians in Japan remained largely hidden until the assassination last year of Shinzo Abe, the former prime minister who was gunned down by a man who held a grudge against the Unification Church, the fringe religious movement.

After Mr. Abe’s death, the Japanese media uncovered connections between the church and more than 100 members of Parliament, including the former prime minister, the vast majority of them in the governing party.

Affiliates of the Unification Church have also campaigned against gay and transgender rights in Japan. An editorial in the World Daily, a newspaper with ties to the church, recently declared that the current L.G.B.T.Q. bill “may trigger crime” and that “trans women might invade women’s spaces.”

A political sister organization of the Unification Church said that it had not lobbied lawmakers on the “L.G.B.T. bill in particular” but that it believed the bill “has not been fully discussed and is premature.”

While the Unification Church was heavily scrutinized after Mr. Abe’s death, the Shinto association has operated mostly under the media radar, seeking to influence lawmakers on other longstanding social issues.

It has pushed conservatives to preserve a law that requires married couples to choose one surname and to prohibit female heirs from ascending to the imperial throne.

As an increasing number of municipalities in Japan have offered same-sex partnerships and gay couples have brought lawsuits calling the country’s failure to recognize same-sex marriages unconstitutional, the Shinto association has begun to “feel very threatened by this issue,” said Tomomi Yamaguchi, a professor at Montana State University who studies gender and sexuality in Japan.

The sponsor of the L.G.B.T.Q. bill, Takeshi Iwaya, said he was wary of the way the shrine group had inserted itself into the current debate. “I think they are stepping too deep into policy,” said Mr. Iwaya, a Liberal Democrat.

Approving the current bill required more moderate Liberal Democrats to expend significant political capital, with some facing severe criticism.

“Every day I get calls asking me to oppose the bill, and the phone won’t stop ringing,” said Tomomi Inada, a former defense minister and Liberal Democratic lawmaker who sponsored the bill two years ago. “There is a lot of pressure. People have tried to tarnish my re-election chances.”

Foreign ambassadors, led by the U.S. envoy, Rahm Emanuel, have spoken out in support of the current L.G.B.T.Q. bill, as well as same-sex marriage, while pointing to Japanese public support.

“There’s right-wing efforts that are pretty entrenched, and in my own view they kind of punch above their weight class,” Mr. Emanuel said. “You can’t get to 70 percent” public polling support “without some element of self-identified conservative voters who are saying we’re for same-sex marriage.”

But political apathy makes it difficult for gay and transgender advocates to recruit allies.

Voters think “nothing will change, so they are not interested in politics,” said Gon Matsunaka, director of Marriage for All Japan, an advocacy group.

Business leaders argue that Japan needs to align with its international peers to recruit workers from abroad and keep pace economically.

“Japan has been insisting that we should be homogeneous,” said Takeshi Niinami, chief executive of Suntory, the beverage maker, and chairman of the Japan Association of Corporate Executives. “But now corporates are much more globalizing.”

Although more companies are offering equal benefits to same-sex couples, few employees take advantage of them. Patrick Jordan, vice president of human resources at Coca-Cola Japan, said he knew of only one Japanese employee in an office of close to 600 who was out as gay.

Intolerance of gay relationships or transgender identity in Japan is relatively modern.

During the Tokugawa period, which spanned the 17th to mid-19th centuries, samurai men regularly engaged in same-sex partnerships, said Gary Leupp, author of “Male Colors: The Construction of Homosexuality in Tokugawa Japan.”

Japan stopped criminalizing gay sex long before many Western countries. Both the Kabuki and Takarazuka theatrical traditions embrace fluid gender identities, and gay and transgender performers appear regularly on television. There is a flourishing gay and transgender nightlife in Tokyo.

Yet gay and transgender people say they continue to live hidden lives. Kohei Katsuyama, who lives in Tokyo, quit the police force because he feared repercussions if he told colleagues about his sexuality.

“I thought that if I came out and people found out, it would be game over,” said Mr. Katsuyama, who has cut himself off from his family because he believes they will not accept that he is living with a male partner. “And I think many people still think this way as well.”