On his trip to Iraq this week, President Trump exposed the faces of members of U.S. Navy SEAL Team 5, possibly putting them in danger, an expert said.

During his surprise post-Christmas visit to troops in Iraq, his first trip to a combat zone since he was sworn in last year, the president and First Lady Melania Trump entered the dining hall Wednesday at the Al-Asad base west of Baghdad to greet about 100 troops.

U.S. Navy Lt. Cmdr. Kyu Lee told Trump he is the chaplain for SEAL Team 5. Lee later said Trump told him, "Hey, in that case, let’s take a picture."

.@FLOTUS Melania and I were honored to visit our incredible troops at Al Asad Air Base in Iraq. GOD BLESS THE U.S.A.! pic.twitter.com/rDlhITDvm1 — Donald J. Trump (@realDonaldTrump) December 26, 2018

The ensuing photos and video revealed the presence of the special operations forces, something some experts have said is generally frowned upon if not verboten in war zones.

However, the Office of the Secretary of Defense said in a statement that no rules were violated.

"The special operators voluntarily participated in this open press event," the secretary's public affairs arm stated. "There was no security violation."

Retired U.S. Navy Admiral James Stavridis addressed the matter Thursday on "MSNBC Live with Hallie Jackson."

"It's important he's a SEAL," Stavridis said of the chaplain. "That's a part of the force that is historically supposed to be very, very cloistered, very much in the shadows. If it wasn't a SEAL, it wouldn't be a big deal. Navy SEAL, that surprised me."

Retired U.S. Navy Chief Petty Officer Malcolm Nance is an intelligence consultant for U.S. special operations forces who said by email that the presence of SEAL Team 5 members should not have been revealed.

"The fact is they are a special operations force in a combat zone with a combat role," said Nance, who has also served as a counter-terrorism analyst for NBC News and MSNBC. "The reason their identities are protected is in case of capture."

The former Navy intelligence operative said the exposure would increase their value if they're ever captured by enemies.

"Most of our enemies, including Russian-backed Syrian forces, have very sophisticated social media organizations that follow the activities of these teams very closely," Nance said.

"If protocols have been followed, by digitizing the faces of the individuals (as every other president has done) this would not be an issue," he said. "Now those sailors are a far higher risk while in Iraq just because they posed with Trump."

A retired San Diego-area SEAL officer, who did not want his name used because he still consults with the Department of Defense and is not authorized to speak, said the episode was "much ado about nothing."

"It’s no secret that SEAL Team 5 is in Iraq," he said. "You can ask anybody in Coronado" — one of the SEALs' bases, in San Diego County.

"There’s plenty of things to get upset about with Trump," he said, "and this was not one of them."