Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The governing body of the Boy Scouts of America voted Monday to end its decades-long ban on gay scout leaders.

The organization's national executive board, meeting in Texas, concluded that the policy of excluding gay adults "was no longer legally defensible." The decision was approved by 79 percent of the board.

While the national ban is gone, effective immediately, local scouting units retain the ability to reject gay applicants for leadership positions if hiring them would violate the unit's religious beliefs.

The Boy Scouts national organization said it would defend any local scouting group's "good faith refusal" to admit a scouting leader based upon the group's religious principles.

"This change allows Scouting's members and parents to select local units, chartered by organizations with similar beliefs, that best meet the needs of their families," said a statement from the Scouts' leadership.

"For far too long this issue has divided and distracted us," former Defense Secretary Robert Gates, Scouting's current president, said in a statement. "Now it's time to unite behind our shared belief in the extraordinary power of Scouting to be a force for good in a community and in the lives of its youth members."

The vote represents a remarkably fast turnaround for the Boy Scouts, which only two years ago voted to admit gay young people as scouts but kept the ban on adult gay scout leaders.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Since then, scouting officials have said, rapidly moving legal developments forced a reassessment.

COUNTDOWN TO #BSA VOTE - David may be able to rejoin #Scouting on Mon 7/27 after being removed 22 yrs ago @boyscouts pic.twitter.com/H5B1JyJ7jL — Scouts For Equality (@Scouts4Equality) July 26, 2015

Gates told the organization in May that it must brace for change.

"We must deal with the world as it is, not as we might wish it to be. The status quo in our movement's membership standards cannot be sustained."

Nearly half the states now have laws prohibiting discrimination on the basis of sexual orientation, and almost 150 local governments have adopted similar provisions.

Gay adults rejected as scout leaders have threatened to sue, and New York's attorney general opened an investigation of the employment policy at the Boy Scouts of America.

"It would be a losing effort," says an internal Boy Scouts of America memo obtained by NBC News, "for the BSA to continue protecting its policy." The memo concludes that "a protracted legal battle ... is unwinnable."

The vote allowing local units to turn away gay leaders was condemned by some former Scout leaders as a timid measure that would allow discrimination to continue.

Peter McGraith, a gay adult leader from within the Transatlantic Council of Boy Scouts of America, called the vote "an expedient move to preempt legal action against BSA national, rather than a genuine attempt to make BSA inclusive."

John Stemberger, a Florida lawyer who started a breakaway organization called Trail Life USA after the 2013 vote to admit gay Scouts, said by ending the national ban on gay scout leaders, the Boy Scouts "places the churches and religious institutions who sponsor BSA troops at greater legal risk."

Roughly 70 percent of local scouting units are sponsored by religious organizations. But some churches have been openly critical of the ban on gay scout leaders.

Fifteen years ago, the U.S. Supreme Court upheld the Scouts' right to exclude an assistant scoutmaster, James Dale, after he came out as gay. Now the Scouts have concluded they would lose a similar case.

James Dale, himself, agrees.

"Even if you don't exclude a young person, when they become 18 years old they're suddenly not good enough any more? That's definitely the wrong message for the Boy Scouts of America."

Other rights organizations also noted that Monday's move was perhaps only a half step.

"Today’s vote by the Boy Scouts of America to allow gay, lesbian and bisexual adults to work and volunteer is a welcome step toward erasing a stain on this important organization," said Human Rights Campaign President Chad Griffin in a statement after the vote. "But including an exemption for troops sponsored by religious organizations undermines and diminishes the historic nature of today's decision."