(CNN) President Donald Trump made his first visit to a war zone on Wednesday, receiving an enthusiastic reception from many US troops there -- some of whom may have run afoul of military rules.

Video footage and the written report of Trump's visit with service members in Iraq showed the President signing "Make America Great Again" hats and an embroidered patch that read "Trump 2020."

A US military official told CNN the MAGA hats that Trump signed at the Ramstein Air Base event in Germany were personal and brought there by military personnel in hopes of getting an autograph. The official contended that it was not a campaign event and that the hats were used as support for Trump, not as a statement of political support.

Although the event was not an official Trump re-election campaign event, the President did declare his candidacy for re-election in 2020 soon after his inauguration.

White House press secretary Sarah Sanders told CNN the hats were personal items brought by the troops in Iraq and Germany. Sanders said the White House did not distribute them.

Read More