Washington (CNN) By injecting a heavy dose of campaign-style rhetoric and partisan optics into this week's holiday visit with troops in Iraq -- his first trip to a war zone since taking office -- President Donald Trump has once again proved he has no problem blurring the lines between politics and his relationship with the US military, according to military experts and a top Democratic lawmaker.

Traditionally, US presidents have sought to preserve the military's standing as an apolitical institution by avoiding partisan issues while visiting with service members, wary of putting troops in any situation that could be construed as an endorsement of specific political candidates.

But Trump has not shied away from politicizing the military in the past, as he did during last month's controversial Thanksgiving phone call with service members stationed around the world, when he steered the conversation toward controversial political topics.

He continued that trend Wednesday during his first visit to a war zone, using his appearance at an air base west of Baghdad to hammer Democrats over issues like border wall funding, defend a recent series of foreign policy decisions that have been widely criticized at home and repeat the falsehood that he had given troops their first pay raise in more than 10 years.

Trump also posed for photographs with at least one service member who was holding a Trump-Pence campaign sign, and he autographed red "Make America Great Again" hats for troops in fatigues, despite military guidelines that prohibit active-duty troops from participating "in partisan political activities" and the expectation that they keep their political views private while in uniform.

"The President doesn't need to do that ... the troops are just enthusiastic when the President of the United States shows up. It's kind of a rock star kind of a status," said retired Maj. Gen. James "Spider" Marks, a CNN military analyst, on Thursday.

"I think it's kind of a misplaced opportunity; the President really just needs to kind of marinate in the moment of being with these incredible soldiers who are protecting our freedoms, and that's what it's really all about," he added.

Trump's visit came at a fraught moment for the President and the military. Trump's defense secretary resigned last week after the Syria troop decision, writing in a departure letter that the President deserved a military chief more aligned with his worldview. His replacement, a former Boeing executive, has scant foreign policy or military experience.

Trump had faced scrutiny for putting off a visit to the troops. Privately, he wondered whether such a trip would only serve to highlight wars he does not support and wants to end. But in November, after facing criticism for canceling a visit to a military cemetery in France because of rain, Trump announced he would soon travel to a war zone.

MAGA hat controversy

One US military official and the White House maintained Thursday that the campaign gear signed by Trump had been brought to the event by the troops, a distinction they argued indicates that the items were personal, rather than political in nature.

Asked if the White House had distributed the hats, which appeared to be brand-new, to troops in Iraq and those who met with Trump during a refueling stop at Ramstein Air Base in Germany, press secretary Sarah Sanders told CNN they were personal items brought by the service members.

The optics of Trump signing items commonly found at his campaign rallies have continued to raise concerns among those who believe that his behavior was not only inappropriate, but also sent the wrong message to service members and the American public.

"Trump has blurred the line between the office of the presidency and the campaign to such a degree that it is making it much more difficult for troops to make that distinction on their own," according to CNN military analyst John Kirby, a former Pentagon spokesman.

"I hope that in the wake of the images that came out, military leaders there and here in DC are taking a look at the protocols and procedures ... of briefing service members before these types of visits ... particularly by this President," he said. "It's bad enough that Trump doesn't see a problem with signing campaign paraphernalia at a military base, maybe even more so that some of our troops are OK with it."

A US military official said Thursday that troops did not violate military policy by bringing signs and hats to the events, telling CNN the MAGA hats signed by Trump at the Ramstein event were personal items brought there by military personnel in hopes of getting autographs.

The official also contended that Trump's meeting with service members was not a campaign event, that there is no campaign currently underway and that the hats were used as support for Trump, not as a statement of political support.

Responding to questions about the Ramstein event Thursday, Air Force spokesperson Capt. Christopher Bowyer-Meeder said the service has not been notified of any policy violations at this time and pointed out that there is no rule against airmen bringing personal items to be signed by the President.

Politicizing the military

That explanation did little to temper criticism from some lawmakers about what they viewed as an effort by Trump to manipulate the military for political purposes.

"President Trump must not take actions to politicize the US military or military service members," said Democratic Rep. Adam Smith of Washington state, the incoming chairman of the House Armed Services Committee, in a statement Thursday.

"The President has a history of crossing that line. It is wrong to put service members in such a position and it severely undermines our democratic principles," he added.

According to Kirby, Trump's actions during the trip to Iraq stem from his misguided understanding of the relationship between a commander in chief and the military.

"He conflates the obedience of the troops with political alignment and does not realize they are not political supporters of him, they are subordinates," he said.

Kirby said he believes the vast majority of troops understand that they are expected to leave their politics at the water's edge, but he acknowledged that some service members likely walked away from Wednesday's event seeing nothing wrong with the way Trump behaved despite strict guidelines intended to protect the military from the perception that it endorses a particular political candidate.

"One big danger is imbuing in the American people's mind that the military's loyalty is not to them, but to Donald Trump," he said. "When Trump behaves this way, it conveys a message to the American people that the military is not there for them, it's there for him."