Donald Trump is changing the rules for presidential campaigning, even within the walls of the Pentagon.

In recent weeks, Defense Secretary Ash Carter has repeatedly rebuffed questions related to the Republican front runner and the broader 2016 campaign, saying that military interference in the election process would be inappropriate.

During a recent hearing before the House Armed Services Committee, Carter repeated his standard line : "I feel very strongly that our department needs to stand apart from the electoral season so I respectfully decline to answer any questions that arise from the political debate going on."

Appearing on Capitol Hill late last month, he sought to shield the military's top officer, Marine Corps Gen. Joseph Dunford, from having to weigh in on remarks Trump had made about the use of torture.

Pentagon officials asked about Donald Trump's torture remarks Rep. Betty McCollum, D-Minn., asks Defense Secretary Ash Carter and Joint Chiefs Chairman Gen. Joseph Dunford about Republican presidential hopeful Donald Trump's remarks on torture. The exchange occurred on Capitol Hill in March.

Carter has been specifically concerned about having military leaders — including Dunford, the Joint Chiefs chairman, — seen as influencing or meddling in the election. In Pentagon press conferences, Carter’s top spokesman, Peter Cook, has promised "not discuss the presidential race from this podium" inside the Defense Department headquarters.

But that hasn't stopped the questions, or the indirect answers.

× Fear of missing out? Sign up for the Early Bird Brief - a daily roundup of military and defense news stories from around the globe. Thanks for signing up. By giving us your email, you are opting in to the Early Bird Brief.

This week, after Trump called NATO "obsolete" and too expensive for America, a chorus of Pentagon officials pushed back. Without naming Trump, Cook called the alliance "as relevant as ever." Dunford also offered his own strong defense.

"In my mind, the relevance of NATO is not at all in question," he said during a March 30 press conference. "In fact, I think it's a question of making sure we have the right focus because there's a lot of work to be done."

Earlier in the month, South Carolina Sen. Lindsey Graham, whose own Republican presidential campaign was derailed in large part to Trump's aggressive attacks, used a defense budget hearing to similarly poke at the controversial business mogul.

Graham pressed Dunford to respond to "some who have suggested that we intentionally target civilians in the war on terror and that we go back to using waterboarding." The questions followed a thinly-veiled letter from Graham to the Pentagon asking whether Trump's anti-terrorism plans are legal, without mentioning him by name.

Dunford, in turn, responded by slamming Trump's suggestions without specifically referencing the candidate or his campaign trail comments.

"Our men and women … go to war with the values of our nation, and those kind of activities that you've described, they are inconsistent with the values of our nation," he said. "What you are suggesting are things that actually aren't legal for them to do anyway."

In December, THE Pentagon offered a similar rebuke of Trump's proposal to bar Muslims from entering the country, calling it "not only contrary to our values, but contrary to our national security."

Even Carter, in a California press conference in February, told reporters he would not comment on the presidential race and then immediately waded into Trump’s comments about promising to force U.S. allies to take on a larger role in world security.

"What is our role in the world? Well, we are the leading power," he said. "People look to us. They look to us because, as I said, of what we stand for. They look to us because many of them are our allies and security partners."

Trump isn’t the only candidate to force unwanted commentary from military leaders in recent weeks. Texas Sen. Ted Cruz, his top Republican rival on the campaign trail, elicited a number of comments from defense officials when he suggested "carpet-bombing" parts of Iraq and Syria to fight the Islamic State group .

But Trump has been the most problematic for the Pentagon's no-politics promise, even if his name is almost never mentioned. But that's a key distinction, according to long-time defense analyst Larry Korb.

"The Pentagon should stay out of this stuff, but if they're asked questions about their policies and priorities they have to answer," said Korb, a one-time assistant secretary of defense for President Ronald Reagan and a current adviser to presidential hopeful Bernie Sanders.

"As long as they're saying things like 'Here's what we think about NATO' and not 'Trump is wrong because…' then they're doing it right. But you have to answer these questions."

Leo Shane III covers Congress, Veterans Affairs and the White House for Military Times. He can be reached at lshane@militarytimes.com.