In an unexpected move, The Church of Jesus Christ of Latter-day Saints gave its support Tuesday to a proposed federal law that would recognize all legal marriages and codify marriages between same-sex couples.

The nearly 17-million member, Utah-based faith said in a statement that church doctrine would continue to consider same-sex relationships to be against God’s commandments. Yet it said it would support rights for same-sex couples as long as they didn’t infringe upon religious groups’ right to believe as they choose.

"We believe this approach is the way forward. As we work together to preserve the principles and practices of religious freedom together with the rights of LGBTQ individuals much can be accomplished to heal relationships and foster greater understanding," the church said in a statement posted on its website.

Mormon church

Sandy Newcomb poses for a photograph with a rainbow flag in front of The Church of Jesus Christ of Latter-day Saints in Salt Lake City.  (AP Photo/Rick Bowmer, File)

Support for the Respect for Marriage Act is under consideration in Congress and is the church’s latest step to take a more welcoming stance toward the LGBTQ community while holding firm to its belief that same-sex relationships are sinful. 

RELIGIOUS WATCHDOG GROUPS WARN SECULAR SOCIETY CAUSING ‘SELF-CENSORSHIP’ AMONG CHRISTIANS

The bill repeals the Clinton-era Defense of Marriage Act and safeguards interracial marriages by requiring that valid marriages are recognized regardless of "sex, race, ethnicity or national origin."

The group added an amendment to the Respect for Marriage Act, intended to address conservatives' religious liberty concerns, "while leaving intact the core mission of the legislation to protect marriage equality," according to a joint statement from Sens. Tammy Baldwin, D-Wis., Susan Collins,R-Maine, Rob Portman, R-Ohio, Kyrsten Sinema, D-Ariz., and Thom Tillis R-N.C..

The bipartisan amendment ensures nonprofit religious organizations will not be required to provide services, facilities or goods for the celebration of a same-sex marriage, and protects religious liberty and conscience protections available under the Constitution and federal law, including the Religious Freedom Restoration Act

UTAH GOVERNOR SLAMS OREGON FANS FOR OBSCENE CHANT AT BYU FOOTBALL GAME 

It also does not authorize the federal government to recognize polygamous marriage and safeguards any benefit or status of an entity as long as it does not arise from a marriage. 

Mormon temple

Flowers bloom in front of the Salt Lake Temple, at Temple Square, in Salt Lake City. (AP Photo/Rick Bowmer, File)

Finally, the amendment "recognizes the importance of marriage, acknowledges that diverse beliefs and the people who hold them are due respect, and affirms that couples, including same-sex and interracial couples, deserve the dignity, stability and ongoing protection of marriage."

Utah's four congressmen each came out in support of the legislation earlier this year despite all of them being practicing members of the church.

CLICK HERE TO GET THE FOX NEWS APP

The bill was passed by the U.S. House of Representatives earlier this year, but the Senate pushed back its vote in the hopes of garnering the support needed in the chamber to ensure it becomes law. It is set for a test vote in the Senate on Wednesday, with a final vote as soon as this week or later this month. 

The Associated Press contributed to this post.