“If I was part of shaping the narrative” concerning the strike on General Suleimani, Mr. Hegseth said in a telephone interview on Monday, “well, that’s a wonderful part of my day job.”

Mr. Hegseth’s views, which have greatly evolved since his time in the Army and his tenure leading two conservative veterans organizations, are emblematic of the seismic shift among many Republicans under Mr. Trump on long-held foreign policy positions. They also reflect a slow but significant souring among veterans on the post-9/11 conflicts that many believe have cost the nation too much in lives and money.

“I think a lot of us who were very hawkish and believe in American military might and strength were very resistant to how candidate Trump characterized the wars,” Mr. Hegseth said in another recent telephone interview. “But if we are honest with ourselves, there is no doubt that we need to radically reorient how we do it. How much money have we invested, how many lives have we invested and has it actually made us safer? Is it still worth it?”

Mr. Hegseth’s influence was most pronounced late last year when he lobbied heavily on behalf of Chief Petty Officer Edward Gallagher, a member of the Navy SEALs who was acquitted of serious war crimes. Mr. Trump reversed a demotion ordered as punishment, and then fired the secretary of the Navy, whom Mr. Hegseth had aggressively criticized.

Mr. Hegseth took to Fox News in November to defend Chief Gallagher. “From the beginning, this was overzealous prosecutors who were not giving the benefit of the doubt to the trigger pullers,” he said.