Retired Gen. James Mattis sailed through his confirmation hearing Thursday as a hardened warrior who cherishes allies, prefers diplomacy to conflict, deeply distrusts Russian President Vladimir Putin, and promises to speak his mind “frankly and forcefully” whenever he disagrees with President Trump.

To many Trump skeptics, this has always been Mattis’ main appeal—that his street cred as a retired four-star Marine general and a noted scholar of history and strategy would serve as restraining influence to Trump’s unpredictability and to the extreme belligerence of the president-elect’s national security adviser, retired Lt. Gen. Michael Flynn.

The appeal is so strong that most senators are willing to overlook the law prohibiting officers from serving as secretary of defense until seven years after they’ve retired. Mattis retired just four years ago, and so required a waiver to take office. Congress has passed such a waiver just once, in 1950, when President Harry Truman nominated five-star Gen. George Marshall to the position. After Thursday’s hearing, the Senate Armed Services Committee approved a waiver for Mattis by a margin of 24–3. Two hours later, the full Senate voted the same way, 81–17.

Sen. John McCain, the committee’s chairman, cited testimony from earlier this week by two scholars on civil-military relations who strongly supported the law barring recently retired officers from taking the job but also strongly supported making an exception for Mattis. One of those scholars, Eliot Cohen, a noted author and professor, former State Department official, and, during the presidential campaign, an instigator of the “Never Trump” movement launched by conservative national-security specialists, said at this earlier hearing that Mattis “would be a stabilizing and moderating force, preventing wildly stupid, dangerous, or illegal things from happening.”

Mattis lived up to that image at his confirmation hearing on Thursday. Contrary to Trump’s disparagement of NATO as obsolete, Mattis called it “the most successful military alliance in modern world history,” adding, “If we did not have NATO today, we would have to create it.” Asked if the United States should refuse to honor its commitment to NATO members that hadn’t spent a lot of money on their own defense (another position that Trump has taken), Mattis vigorously disagreed. He also said that he’d discussed this subject with Trump, who was “open” to hearing Mattis’ view and asked follow-up questions.

At particular odds with Trump’s benign view toward the Kremlin, Mattis called Putin “an adversary in key areas” whose main goal is to disrupt the North Atlantic alliance. Mattis said he’s fine with Trump’s desire to engage with Putin. “Even in the worst years of the Cold War, we had engagement,” Mattis said. “But I have very low expectations.” When he was asked to name the key threats to the United States, he put Russia at the top of the list.

On other matters of difference with the president-elect, Mattis said that he has a “very high level of confidence” in the U.S. intelligence community; that, while he regards the Iran nuclear deal as “an imperfect agreement,” which he would not have signed, he is opposed to scrapping it; and that allies are crucial to the success of any foreign policy or military operation. “Nations with allies thrive. Nations without allies don’t,” he said.

He disagreed with some of his most supportive senators on some issues as well. Republican Sen. Lindsey Graham, of South Carolina, asked Mattis whether he regards Jerusalem as the capital of Israel. Mattis demurred, saying Tel Aviv is the capital, “because that’s where all the government offices are,” and said he would abide by long-standing U.S. policy, which holds the same position. He also disagreed with one senator’s view that the United States currently has no strategy to resist ISIS in Syria, saying that we do have a strategy but that he would “energize” it on “a more aggressive timetable.”

Mattis did not fully address concerns, expressed by many in recent weeks, that his experience as a military commander, however admirable, might not translate to the skills necessary to run a massive bureaucracy like the Department of Defense, with its $600 billion–plus budget—nor whether he could look past his deep knowledge of military tactics and strategy to encompass a broad view of national-security policy. This concern underlies the principle of civilian control: The military is supposed to execute the policies laid out by the president through the Cabinet, including the secretary of defense. At one point in the hearing, Mattis unwittingly underscored the problem, saying that he would give the president and the Congress his “professional military judgment.” That is usually the job of the chairman of the Joint Chiefs of Staff, not the secretary of defense.

Democratic Sen. Richard Blumenthal, of Connecticut, told Mattis, “If there was ever a case for a waiver to that principle [of civilian control], it is you, at this moment in our history.” Nonetheless, Blumenthal was one of the three senators who voted against granting him a waiver. The others were also Democrats: Kirsten Gillibrand of New York and Elizabeth Warren of Massachusetts. (This was Warren’s first hearing as a member of the Armed Services Committee, which some speculate she joined as a way of expanding her portfolio for higher ambitions.) Neither Gillibrand nor Warren so much as brought up the issue in their questioning of Mattis. Warren even encouraged Mattis to push his views forcefully in the White House, saying, “We’re counting on you.”

During the hearing, Mattis changed or at least modified some of his controversial views. In the past, he has opposed integrating women into infantry units alongside men, concerned that sexual appetites would cut into their prowess as fighters. At the hearing, he said, “I have no plan to oppose women in any aspect of our military,” adding that in 2003, the division he commanded in Iraq had “hundreds of Marines who happened to be women … right in the front lines along with everyone else.” He did say, “If we are going to execute policy like this, we’d better train our leaders to handle all problems.” He also expressed no problem with gays serving in the military. He said, “I’ve never cared much about two consenting adults and who they go to bed with.” Asked point blank whether there was anything about women or gays that made him think they could not be part of a “lethal force,” he said, “No.”

He also seemed to have undergone a change in his views on the “triad”—the land-based intercontinental ballistic missiles, submarine-launched ballistic missiles, and bombers—that has long made up the U.S. nuclear arsenal. In the past, he has favored the dismantlement of the land-based ICBMs, viewing them as destabilizing. Many arms-control advocates have noted that, because ICBMs are at once the arsenal’s most accurate and most vulnerable weapons, they would be both useful for a first strike and the natural targets of an enemy first strike. As a result, in a crisis, especially during a false alarm, their very existence might encourage one side or the other to launch a first strike, if only to pre-empt the other side’s first strike.

However, at Thursday’s hearing, he said that ICBMs add another layer of deterrence to the nuclear balance. Because they are based underground, in blast-resistant silos, an adversary would have to fire two, three, or even four warheads to ensure destroying each silo—using up so many of his own missiles that he’d be dissuaded from launching an attack in the first place. In recent years, Air Force officers have devised this argument as a rationale for keeping ICBMs. Many civilian strategists—and officers of the Marine Corps, which has never had nuclear weapons—find the argument far-fetched, noting that the presence of nuclear missile–carrying submarines (prowling, undetectable, under the ocean’s surface) and bombers (which can take off at a moment’s notice and be recalled back to their bases, if necessary) are deterrent enough to prevent a nuclear war.

Though the issue did not come up at the hearing, Mattis has reportedly had several run-ins with the Trump transition team, rejecting all of the names they’ve sent him as possible deputy, under, and assistant secretaries of defense. Given Mattis’ lack of managerial experience, the position of deputy secretary—who usually runs the Pentagon’s day-to-day operations—is particularly important. The Trump team is said to be mulling the idea of keeping the present deputy secretary, Robert Work, in the position, at least for a while.