CNN’s Pentagon correspondent said that President Trump Donald John TrumpSteele Dossier sub-source was subject of FBI counterintelligence probe Pelosi slams Trump executive order on pre-existing conditions: It 'isn't worth the paper it's signed on' Trump 'no longer angry' at Romney because of Supreme Court stance MORE signing red “Make America Great Again” hats for troops in Iraq may have violated Defense Department rules.

"What commander allowed that to really happen?” Barbara Starr asked Wednesday night.

“This is very much against military policy and regulation,” Starr said. “Troops are not supposed to be involved in political activities; the U.S. military is not a political force.”

The president and first lady Melania Trump Melania TrumpThe Hill's Campaign Report: Trump faces backlash after not committing to peaceful transition of power FBI director casts doubt on concerns over mail-in voting fraud Trump: 'We could hardly hear' boos, chanting at Supreme Court MORE made unannounced visits to Iraq and Germany on Wednesday to visit the troops. Video footage showed Trump signing the red baseball caps that were a symbol of his presidential campaign.

ADVERTISEMENT

“The sayings 'Trump 2020' and 'Make America Great Again' are political slogans of a Trump campaign. They are not governmental sayings, to say the least,” Starr said.

Defense Department policy says that "active duty personnel may not engage in partisan political activities and all military personnel should avoid the inference that their political activities imply or appear to imply DoD sponsorship, approval, or endorsement of a political candidate, campaign, or cause."

Pool reporters said some of the troops had brought their own hats, including one that said “Trump 2020.”

“We will have to see if that actually proves to be the case,” Starr said.

Retired Rear Adm. John Kirby, a CNN analyst, also accused Trump of politicizing the visit, and called the hat signing “completely inappropriate.”

"Every time he's around military audiences, he tends to politicize it, and he brings in complaints and grievances from outside the realm of military policy,” Kirby said on CNN.

And CNN military analyst retired Lt. Gen. Mark Hertling said that Trump put military personnel “in a very bad position” with his comments to the troops, which were criticized as being akin to a “campaign rally.”