Donald Trump made a joke about TV ratings during a solemn military ceremony that honours the American flag.
The US President was at the Air National Guard base in Pennsylvania when the “Retreat” bugle call started to play.
Tradition dictates that civilians are expected to put their hands over their hearts during the 25-second tune.
As the tune struck up the US leader, who never served in the US military, was being interviewed on Fox News.
Referring to the bugle as a “nice sound”, Mr Trump asked host Sean Hannity: “Are they playing that for you or for me?”
He added: "They’re playing that in honour of his ratings. Did you see how good his ratings were? He's beating everybody."
His comments led to scattered cheering and clapping in the crowd.
US military newspaper, the Fort Gordon Globe, reported that "Retreat" is traditionally played a time to secure the flag at the end of the day. Service members are expected to “show courtesy” and “respect” during the ceremony.
Part of tradition since before the American Revolutionary War, uniformed military personnel are required to stop and salute the flag, while civilians place their hand over their heart.
Mr Trump’s apparent ignorance of the custom follows weeks of condemnation from the 71-year-old about NFL players “disrespecting” the country’s flag by kneeling during the national anthem, which is traditionally played ahead of all American sporting events.
He told his supporters any “son of a b****” who decided to kneel should be “fired”.
He added that any team owner who did so, would "be the most popular person in this country."
The kneeling protests have been gaining momentum since Colin Kaepernick, an NFL quarterback currently without a team, went down during the national anthem at a pre-season game in 2016, in the wake of a number of shootings of black men by white police officers.
He said he wanted to protest “a country that oppresses black people, and people of colour”.