SALT LAKE CITY -- The Mormon church announced Wednesday that it will maintain its longtime affiliation with the Boy Scouts despite the decision to allow gay troop leaders despite the organization's decision to allow gay troop leaders -- preventing what would have been a thundering blow to the national association.

The decision from senior leaders of the Mormon church-- the largest U.S. sponsor of Boy Scout units -- came as somewhat of a surprise. The church said it was deeply troubled and considering other options when the Boy Scouts announced on July 28 that it would lift its ban on gay adult leaders, while allowing church-sponsored Scout units to continue excluding gay adults.

Church leaders decided to stay with the Boy Scouts after getting assurances they can appoint troop leaders according to their own religious and moral values, The Church of Jesus Christ of Latter-day Saints said in a news release Wednesday.

The Mormon church sponsors nearly 38,000 Scout units with 427,000 boys -- accounting for about 18 per cent of all youth Scouts.

Officials with the Boy Scouts of America said it appreciates the decision, noting that the organization is successful because of affiliations with groups like the Mormon church.

The renewed commitment from the LDS Church did include an important caveat: The church said it will continue evaluating and refining alternatives to Boy Scouts that would better suit the increasingly global membership of the religion. With more than half of the religion's 15 million members living outside the United States, there has long been speculation the Salt Lake City-based religion will create its own scouting-type program.

The bond between the Scouts and Mormons goes back to the early 1900s and involved mutual values and principles.

As the religion's membership swelled, Boy Scouts became a rite of passage for Mormon boys, with church covering the cost of troops for congregations, known as wards, and strongly encouraging participation.

Some had speculated the church would cut ties in 2013, when Boy Scouts decided to allow openly gay youth.

Mormon leaders have softened their tone about gays and lesbians in recent years. Church leaders were involved in legislation enacted in Utah in March that extended nondiscrimination protections to gays, lesbians, bisexuals and transgender people.

But those leaders have also made it clear that the church still opposes gay marriage and believes homosexual activity is a sin.

A number of rank-and-file Mormons are pushing the church to become more accepting and welcoming of LGBT members. Groups have formed to represent the movement.