Mark Zaleski / AP

Eagle Scout. Young Republican. CIA recruit. Air Force officer. CIA director. Secretary of defense.

It’s not the resume of a radical civil-rights campaigner, but Robert Gates has now integrated two of the great bastions of macho American traditional morality—first the U.S. armed forces, and now the Boy Scouts of America. In both cases, Gates pursued a careful, gradual strategy, one that wasn't fast enough for activists. In both cases, he was careful to take the temperature of constituents. And in both cases, once he was ready to act, he did so decisively. In the end what seemed to matter most was not Gates’s personal feelings but his determination to safeguard institutions he cared about and his deft skills as a bureaucratic operator.

Before the Obama administration began moving to eliminate the military’s “don’t ask, don’t tell” policy there was barely any indication of Gates’s views on LBGT issues—though not none. In 1991, while director of central intelligence, Gates ordered an inquiry into whether CIA personnel had ever been blackmailed into espionage because they were gay. When he found no cases, he ended the practice of asking employees about their sexual orientation as part of polygraph tests. From 2002 until he took over the Pentagon in 2006, Gates was president of Texas A&M University, a famously culturally conservative school. (In 1984, students sued, successfully, to force the school to recognize a gay-student organization; the ruling effectively removed all legal prohibitions on LGBT student groups nationwide.) At A&M, Gates worked to improve student diversity overall—including racial minorities and LGBT students—and appointed the school’s first administrator specifically in charge of diversity.

Given the rapid advance of gay rights over the last decade, it’s tough to remember just how different the stage was in 2006, when Gates replaced Donald Rumsfeld as defense secretary. “Don’t ask, don’t tell” had had plenty of critics since it was enacted in 1994—President Bill Clinton himself would have preferred simply opening the military to gay servicemembers—but it was still firmly in place. The Bush administration was not interested in lifting the ban, and Gates took a cautious approach. He repeatedly told reporters that he was not reviewing or reconsidering the policy.

When, several months into his tenure, the chairman of the Joint Chiefs of Staff, General Peter Pace, said that “homosexual acts between individuals are immoral,” Gates tried to avoid discussing the comments, and said of DADT, “As long as the law is what it is, that's what we'll do.” (Pace, who retired in September 2007, reiterated his personal opposition to homosexuality during an exit hearing with Congress, but also endorsed gay service in the military.) When, two months later, the military ejected 58 desperately needed Arabic linguists because they were gay, Gates still said the policy wasn’t under review.

Even after President Obama was elected and Gates accepted an offer to stay on as secretary, he remained cautious. Though the president pledged to repeal DADT during his first State of the Union, Gates expressed a preference in March 2009 to “push that one down the road a little bit,” infuriating gay activists. Yet in June, he was clearly expecting the policy to end and was exploring whether “there’s a more humane way to apply the law until it gets changed.” A similar pattern held in 2010, as Gates warned Congress not to repeal DADT before he had a policy in place for the aftermath and insisted courts not make the decision. He also issued a survey on gays to servicemembers, a step that LGBT activists, who saw it as putting civil rights to a vote, disagreed with. Yet there Gates was in the fall, saying DADT’s demise was “inevitable” and testifying to Congress in favor of repeal—before the courts did it. (And that survey? It turned out the troops were totally fine with LGBT comrades.)

Once DADT was repealed, Gates moved quickly to enforce discipline and get the change implemented in the military, and shot down any hopes that soldiers, sailors, and marines who disagreed with the policy could leave their commitments early.

Gates’s push for the end of DADT never relied on the soaring rhetoric of rights and justice that people like Obama used. Gates spoke with the dry, careful language of a bureaucrat, speaking in terms of unit cohesion, military readiness, and obstacle recognition. When he indulged emotion, it was to praise soldiers risking their lives—the same language a defense secretary would use for straight soldiers. The decision was more than anything a triumph of pragmatism. Gates carefully studied the effects repeal would have on the military and decided the downsides were minimal; and he looked at the way the country was changing and realized that the policy would have to end soon, and that he wanted it to end on the Pentagon’s terms to ensure the military’s stability and long-term health.

The DADT fight offers a template for the opening to gay scoutmasters. Gates had expressed tempered sympathy for gays in scouting as far back as 1993, when he told Wichita Rotarians, “Values central to Scouting are under challenge today as never before: challenges to our belief in God, challenges from Americans who are gay. Scouting must teach tolerance and respect for the dignity and worth of every individual person, certainly including gays.”

The Boy Scouts had already begun to dismantle some of their anti-gay policies when Gates was elected president in late 2013. A lopsided vote in May 2013 ended a ban on gay scouts but kept prohibitions on gay scout leaders and volunteers in place. Just as he had at Defense, Gates initially took a carefully diplomatic position. “I was prepared to go further than the decision that was made,” Gates said in May 2014. “I would have supported having gay Scoutmasters, but at the same time, I fully accept the decision that was democratically arrived at by 1,500 volunteers from across the entire country.” He said he wouldn’t reopen the decision during his term as president.

At some point in the last year, he had a change of heart.

The shift seems to reflect much the same calculus that guided Gates through the DADT decision. At the Pentagon, he had first avoided discussing repeal because it seemed too likely to create institutional instability; but once he decided that the writing was on the wall and that refusing to change was the greater risk to the organization, he moved swiftly and effectively to impose his new will. The point was to guarantee institutional survival.

In May 2015, one year after saying he wouldn’t reopen the issue of gay scoutmasters, Gates did just that. In short, he decided once again that if the institution he led didn’t change its policies now, a judge was likely to force it to do so later.

“The status quo in our movement's membership standards cannot be sustained,” he said. “Between internal challenges and potential legal conflicts, the BSA finds itself in an unsustainable position, a position that makes us vulnerable to the possibility the courts simply will order us at some point to change our membership policy.”

Gates warned that a court order would disarm the Boy Scouts’ ability to act of their own volition, and suggested that doing anything besides opening would be an existential threat.

“I truly fear that any other alternative will be the end of us as a national movement,” he said.

Monday evening, Gates got his wish, as the BSA’s 80-member board voted to approve the change. (A smaller executive committee had already approved it.) The new policy may not satisfy everyone. Traditionalists are upset about the move, while progressives feel it doesn’t go far enough—troops that are chartered by churches and other religious organizations would still be permitted to set their own standards. Regardless, the policy marks a serious shift for BSA, and it cements Robert Gates’s place in history: as one of the least likely but most successful proponents for gay equality in institutional America.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.