President Trump’s nominee to become the next top U.S. military officer promised lawmakers on Thursday that, if confirmed, he would not be cowed by the White House as he provides advice on national security matters. 

Gen. Mark Milley, who serves as Army chief of staff, appeared before the Senate Armed Services Committee at a moment when Trump’s moves to pull the Pentagon into his border wall plans, Independence Day festivities and other initiatives have generated concerns about the erosion of the military’s nonpartisan tradition.

If confirmed, Milley would replace Marine Gen. Joseph F. Dunford Jr. as chairman of the Joint Chiefs of Staff in the fall. 

Sen. Angus King (I-Maine) asked Milley if he would challenge the president, who since taking office has questioned decades-old defense alliances and adopted positions that have caused discomfort within the military’s highest ranks. 

In response to the general’s vow to remain independent, King said: “I believe that. But I think it’s very important to emphasize that the Oval Office is an intimidating place, and the president of the United States is the most powerful leader in the free world. To be willing to say, ‘Mr. President, you’re wrong about this’ . . . if it’s something that she or he doesn’t want to hear is just, there is no more important responsibility in your career.” 

Milley replied that Dunford and “most of us” have seen a lot of combat.

“Arlington is full of our comrades, and we understand absolutely full well the hazards of our chosen profession,” Milley said, referring to the national cemetery a few miles away in Virginia where many U.S. service members are buried. 

“We know what this is about, and we will not be intimidated into making stupid decisions,” he said. “We will give our best military advice and not keep the consequences to ourselves.”

Milley, a gruff infantry officer educated at Princeton, became the Army’s top officer in August 2015 after serving in Iraq, Afghanistan and other countries. His nomination by Trump in December, which came surprisingly early, defied the recommendation of then-Defense Secretary Jim Mattis, who had recommended the Air Force’s top officer, Gen. David L. Goldfein.

It’s not clear how Trump, who appears to have gained confidence in his instincts on foreign policy as his presidency has gone on, would take to being challenged by Milley. Mattis, who during his initial period as Pentagon chief steered defense policy back toward traditional positions, resigned in December over Trump’s treatment of key allies. 

Milley would take on new responsibilities for an institution experiencing intense leadership upheaval.

This week, officials unveiled a plan for installing the Defense Department’s third acting secretary this year, as federal personnel rules require acting defense secretary Mark Esper — who has been serving as Milley’s civilian counterpart leading the Army since 2017 — to step aside while the Armed Services Committee considers whether to confirm him for the top Pentagon job.

Senate officials on Thursday said Esper’s confirmation hearing would take place Tuesday.

Also this week, the man poised to become the Navy’s top officer, Adm. William Moran, announced he would instead retire over his connection to a Navy officer accused of treating female personnel inappropriately.

The president intends to announce Vice Adm. Mike Gilday, the director of the Joint Staff at the Pentagon, as his next pick to lead the Navy, a senior U.S. official said Thursday. The news was first reported by the Wall Street Journal.

The nominee to become Joint Chiefs vice chairman, Air Force Gen. John Hyten, faced questions about whether he will be confirmed following a revelation Wednesday that he has been investigated for an alleged sexual assault. Military officials investigated and found no evidence of wrongdoing, but some lawmakers said Thursday that they would like to hear more from the alleged victim, an Army colonel who told The Washington Post that she is willing to testify.

Finally, Gen. David H. Berger took over as the new commandant of the Marine Corps on Thursday.

Speaking during a brisk hearing in which no senator raised questions about his credentials, Milley echoed other Pentagon leaders in affirming that China posed a threat to U.S. military superiority. He said the international order that emerged after World War II was “under the most stress since the end of the Cold War.”

“From East Asia to the Middle East to Eastern Europe, authoritarian actors are testing the limits of the international system and seeking regional dominance, while challenging international norms and undermining U.S. interests,” he said. 

Much of Milley’s job as chairman will involve tending to America’s military alliances as the president, who has espoused a transactional view of those relationships, questions their value.  

Milley must also navigate his duty to execute the commander in chief’s orders while mitigating the impact of internally unpopular decisions, such as the initiative to use military funds to pay for Trump’s border wall. Privately, senior officers have also voiced concern that the involvement of active-duty troops in a mission designed to stem migration at the southern border will detract from the military’s core mission.  

Responding to questions from Sen. Mazie Hirono (D-Hawaii), Milley said he would resign if he were asked to carry out an order that was “illegal, immoral or unethical.” 

Amid recent tensions with Iran, Milley said the U.S. withdrawal from the 2015 nuclear deal had complicated Washington’s ability to build a coalition to confront Tehran’s steps to challenge U.S. interests and allies in the region. He said he did not expect war with Iran.

Milley voiced support for the Pentagon’s refusal to transfer advanced F-35 jets to Turkey, a NATO ally, if it acquires Russian-made S-400 air and missile defense systems. 

“The S-400 is a Russian system built to shoot down aircraft like the F-35,” he said.

Trump has called the S-400 issue “complicated” and said the United States is “looking at different solutions.”

Milley also said he would recommend deploying land-based missiles to the Pacific if the United States proceeds with its planned withdrawal from the Intermediate-Range Nuclear Forces Treaty, a Cold War-era pact that the Trump administration says Russia is violating.