While many American Olympians who win gold in Rio place their right hands over their hearts when listening to "The Star-Spangled Banner" on the podium, others do their own thing. Take Michael Phelps, who after winning the 200-meter butterfly earlier this week stood on the podium with his arms by his side, almost overcome with emotion (and then laughter) as he accepted his 20th career Olympic gold medal.What the Olympians probably don't realize, however, is that the U.S. Flag Code calls for anyone addressing the flag, either during the Pledge of Allegiance or the national anthem, to put their right hands over their hearts. But there's no orientation lesson from the U.S. Olympic Committe that mandates how athletes should appear, which shouldn't be surprising, as Mark Dyreson, Penn State professor and Olympic scholar, tells Bill Plaschke for The Los Angeles Times. This omission is thanks to the rich tradition of freedom of expression in this country. Or, as Dyreson puts it, “In the United States, free speech trumps all.” But where did the idea to regulate the way Americans choose to respect the flag come from, anyway? As it turns out, the U.S. Flag Code dates back to the not-too-distant year of 1942. The decision to enact began with the Pledge of Allegiance—a ritual that used to involve a salute that required you to raise your right hand, flip your palm down, point it toward the flag in a salute and recite the words. These instructions might seem unthinkable today for obvious reasons—they’re reminiscent of rows of Nazis saluting their Fuhrer. But believe it or not, they date from the beginning of the Pledge itself. As Bob Greene writes for CNN, the right-handed salute is part of the Pledge’s strange history. Originally known as the Bellamy Salute, the gesture came to be in the 1890s, when the Pledge of Allegiance was written by Francis J. Bellamy. The Christian socialist minister was recruited to write a patriotic pledge to the American flag as part of magazine mogul Daniel Sharp Ford’s quest to get the flag into public schools. At the time, as Jeffrey Owen Jones reported for Smithsonian magazine in 2003, Bellamy and his boss both agreed that the Civil War had divided American loyalties and that the flag might be able to bridge those gaps. His campaign centered around the 400th anniversary of Christopher Columbus’ arrival in the new world. He published his new Pledge as part of a unified Columbus Day ceremony program in September 1892 in the pages of the Youth’s Companion, a popular children’s magazine with a circulation of 500,000. “At a signal from the Principal,” Bellamy wrote, “the pupils, in ordered ranks, hands to the side, face the Flag. Another signal is given; every pupil gives the flag the military salute—right hand lifted, palm downward, to a line with the forehead and close to it. Standing thus, all repeat together, slowly, 'I pledge allegiance to my Flag…'” (The words of the Pledge itself have a long and contentious history of their own, as Amy Crawford wrote for Smithsonian magazine last year.) The Pledge slowly picked up steam, especially as educators concerned about the gigantic influx of immigrants in the 19th century looked for ways to instill patriotic values and a sense of national, assimilative identity. With their right hands raised, children all over the country recited the Pledge in school and at public events. Then came fascism, and the rise of a salute used by supporters of a charismatic politician named Adolf Hitler. The dictator seems to have made a Nazi "Heil Hitler" with raised arm the official gesture of his party after witnessing Italian Fascists performing the salute. As Jessie Guy-Ryan reports for Atlas Obscura, both the Italians and the Germans claimed that the salute was based in Roman and medieval Germany history, respectively, though they both had purely modern origins—and Smithsonian.com reporter Rose Eveleth notes that confusion over the fascist salute and a similar salute to the Olympic flag made the 1936 Olympics even more hairy politically. Now that the one-armed salute smacked more of totalitarianism than of American patriotism, Americans abandoned the gesture that had been a symbol of national unity for 50 years. The 1942 U.S. Flag Code attempted to distance the Pledge of Allegiance from the country's avowed enemies, instructing saluters to put their right hand over their heart while reciting the Pledge, and also included instructions for people to salute the flag with their right hand over their heart while listening to "The Star-Spangled Banner." (Though the song was written back in 1814, it had only been the United States' official anthem since 1931.) The relatively new tradition of placing the right hand over the heart didn't end controversy over the Pledge, which has withstood multiple legal tests about whether students can be forced to recite it (they can’t) or whether the words “under God” violate the First Amendment (they don’t.) And despite requirements to do both within U.S. code, neither gesture can be enforced. Now, 239 years after the United States' flag first flew, it still stirs up strong emotions. So even if you're not about to medal in Rio, the next time you hear the national anthem or the Pledge, just remember that even the most innocuous-seeming national traditions have a complicated past.