Image copyright AFP Image caption New US citizens follow etiquette as the national anthem is played

US President Donald Trump has criticised NFL players who kneel during the national anthem in protest at what they perceive as racial injustice.

He calls it "disrespecting the flag" but supporters of the protest believe the players are exercising their right to free speech.

But there is a breach of etiquette here enshrined in law.

The Flag Code covers all aspects of etiquette in relation to the Stars and Stripes, including how to behave when the anthem is played. The code is never enforced, however, and there is no punishment for breaching it.

So what should you do when the national anthem is played?

The code states that persons present are expected to stand and face the flag, if there is one. Civilians should stand to attention with right hand over heart, while military personnel in uniform and veterans should salute throughout. A recent amendment to the code said that military personnel out of uniform could also salute.

President Barack Obama famously neglected to put his hand over his heart during the 2008 election campaign. He explained his mistake by saying his grandfather taught him to do this only during the pledge, and to only sing during the anthem.

On the balcony of the White House, President Trump needed a prompt from his wife Melania when he forgot to put his hand on his chest.

Media playback is unsupported on your device Media caption Did First Lady Melania Trump give her husband a 'nudge' during the national anthem? You decide

The Star-Spangled Banner - first verse

Oh, say can you see by the dawn's early light

What so proudly we hailed at the twilight's last gleaming?

Whose broad stripes and bright stars through the perilous fight,

O'er the ramparts we watched were so gallantly streaming?

And the rocket's red glare, the bombs bursting in air,

Gave proof through the night that our flag was still there.

Oh, say does that star-spangled banner yet wave

O'er the land of the free and the home of the brave?

Media playback is unsupported on your device Media caption Alexandra Deutsch, from the Maryland Historical Society, tells the BBC how America got its national anthem

Men not in uniform should remove any headdress with their right hand and hold it at their left shoulder, the code states. This is generally observed at sporting events. NFL players may not put on their helmets until after the anthem is played.

The Flag Code makes no mention of whether the anthem should be sung by those present. However, singing the Star-Spangled Banner is encouraged from school onwards - in some schools it is compulsory. In 1942 the National Anthem Committee wrote that "it is of paramount importance that emphasis be placed upon the singing of the National Anthem".

Image copyright Reuters Image caption Kaepernick made the protest during an exhibition game (file picture)

What should you avoid doing with the flag?

Numerous manufacturers of flag merchandise could be in trouble here. The Flag Code states that it should not be used for any advertising purpose, and should not be embroidered or printed on any material for temporary use.

It should also never be part of a costume or sports uniform, or used as "wearing apparel, bedding, or drapery". Olympic medal winners who celebrate their success by covering themselves in the flag should take note.

Also, the flag should never be displayed upside down, except as a symbol of "dire distress".

Is it illegal to burn the US flag?

Image copyright Getty Images

Protesters throughout the world frequently set alight US flags to demonstrate their hatred of America, but you would not face prosecution for doing so in the US itself. In 1990 the Supreme Court invalidated a federal law against desecration of the flag on the grounds that it was in violation of the First Amendment on freedom of speech.

In fact, burning the flag is sometimes even encouraged. The Flag Code says that no disrespect should be shown to it, but also allows for any flag which is not fit for display to be "destroyed in a dignified way, preferably by burning".

How long has the Flag Code been around?

Experts say that US flag etiquette is important because was created out of respect for the country's historical heritage.

But the code was first drawn up only in 1923 under the auspices of the American Legion, and only became law when the US was at war, in 1942.