Retired U.S. Marine Corps general John Kelly, President-elect Donald Trump’s nominee to head the Department of Homeland Security, promised on his nomination questionnaire to “speak truth to power.”

And at his Jan. 10 confirmation hearing with the U.S. Senate’s Homeland Security and Governmental Affairs committee, Kelly did just that.

The 66-year-old Bostonian, who served in the Marines for 42 years before retiring in 2016, broke sharply with Trump on torture, the Russian election hack, and the president-elect’s vow to build a wall on the southern U.S. border.

Trump aside, Kelly’s hearing was something of a love-fest, with senators from both parties praising him for his military service and integrity, and thanking him for responding promptly to the committee’s questionnaire and—in contrast to some other Trump nominees—completing his ethics disclosures prior to his hearing.

If confirmed, Kelly will head a department that includes the Coast Guard, Customs and Border Protection, Immigration and Customs Enforcement, the Secret Service, and the Federal Emergency Management Agency. The department employs more than 200,000 federal workers.

The question-and-answer repeatedly took a turn toward defiance to the coming Trump administration—perhaps unsurprisingly, considering Sen. John McCain’s prominence on the homeland security committee. McCain, an Arizona Republican, has butted heads with Trump over torture, the wall, and Russia.

But it was Missouri Sen. Claire McCaskill, the ranking Democrat on the committee, who first hinted at Kelly’s opposition to some of Trump’s most authoritarian positions. In her opening remarks, McCaskill quoted Kelly’s questionnaire—specifically, Kelly’s pledge to “speak truth to power” as a member of Trump’s Cabinet.

“That was music to my ears,” McCaskill said.

Taking the mic, McCain asked Kelly if he intended to follow the 1994 U.S. law barring American government agents from engaging in torture—a law the CIA and military violated under President George W. Bush.

Trump said he would seek to “broaden” anti-torture laws to allow waterboarding and other torture techniques that U.S. agents practiced during the Bush years. Kelly said he opposes that plan. “I don’t think we should ever come close to crossing a line we Americans expect to follow in terms of interrogation techniques.”

“So basically, the Geneva Conventions?” McCain asked.

“Absolutely, sir,” Kelly responded.

McCain brought up Trump’s plan to build a 2,000-mile wall across the southern United States in order to keep out migrants including Mexicans, many of whom Trump characterized as “criminals, drug dealers, rapists.”

The wall could cost nearly $40 billion, according to external estimates. Trump had originally insisted that Mexico would cover the cost but is now working with Republicans in Congress to begin building the wall with U.S. funds.

“It’s my experience we need to have barriers,” McCain said, “but building a wall is not the way to prevent the flow of drugs or people illegally across the border.”

Kelly said he agreed. “A physical barrier in and of itself will not do the job. It has to be layered defense. If you build a wall from the Pacific to the Gulf of Mexico, you still have to back that up with human beings, sensors.”

Invoking his tenure as the head of the U.S. military’s Southern Command from 2012 to 2016, Kelly called for Homeland Security to work alongside foreign governments to stop people and drugs from illegally entering the United States. “I believe the defense of the southwest border begins about 1,500 miles south… partnering with great countries as far south as Peru.”

“To include Mexico,” Kelly added, in an apparent subtle dig at Trump.

Kelly also stood opposite Trump on the still-developing Russian hacking scandal. The U.S. intelligence community, including the FBI and CIA, says it detected extensive efforts by Russian agents to influence the U.S. presidential election.

The agencies claim that Russian operatives hacked computer servers—mostly belonging to Democrats—and leaked information, often via WikiLeaks, in order to create an impression of scandal that most experts agree damaged Hillary Clinton’s presidential campaign.

Trump initially dismissed the hacking allegations. More recently, he insisted that Russian information warfare had “absolutely no effect on the outcome of the election.”

Compare Trump’s stance to Kelly’s. When McCaskill asked the nominee if he agreed with the intelligence community’s assessment of Russia’s hacks, Kelly replied simply. “With high confidence.”

If Kelly is confirmed—which is likely—and he acts consistently with his stated positions, the Department of Homeland Security could find itself at odds with its own chief executive on many of Trump’s signature issues.

Kelly didn’t seem too worried. Referring again to his “speaking truth to power” comment, Kelly said he considers principled opposition to authority to be “easy.” “It’s a moral responsibility,” he said.