In what would become an iconic display of mournful resolve after the twin towers fell, members of Congress who had gathered on the steps of the Capitol for a press conference on the evening of September 11, 2001, burst into a spontaneous chorus of “God Bless America.”

Like many Americans watching that night, I was struck by how vulnerable the nation’s leaders seemed as they sang with trembling voices — and, as a teenager who’d been raised on raucous family sing-alongs in an era in which public harmonizing had become profoundly uncool, I was especially touched by the improbable performance. Carrie Meek, a black Democrat from Florida, and Kay Granger, a white Republican from Texas, held hands. The tune was half over before the legislators settled on a common key.

Years later, it’s easy to speculate on why it was “God Bless America” and not, say, “The Star-Spangled Banner” that sprung to the lawmakers’ lips in their moment of communal grief. No one would have wanted to hear about “bombs bursting in air” after the events of that morning — and besides, “God Bless America,” with its stepwise motion and small melodic range, is much easier to sing than our notoriously difficult national anthem.

Read From Kate Smith to Ronald Reagan, a Timeline for ‘God Bless America’

The lovely “America the Beautiful,” though rich in expansive praise of the national landscape, lacks lines with the visceral first-person punch of “land that I love” and “my home sweet home.”

But in the weeks and months after 9/11, as “God Bless America” became the ubiquitous, if unofficial, musical memorial to the nation’s fallen, it seemed an increasingly unlikely choice. Why were we so solemnly intoning a song that achieved its warbling climax by rhyming “foam” with “home”? Everyone seemed to have forgotten that it was neither a hymn nor an authorless folksong but an old Tin Pan Alley tune, like the jaunty “Take Me Out to the Ballgame,” that the song had begun to upstage in America’s ballparks. Here was what appeared to be an earnest, patriotic prayer written by the Jewish composer who’d given the world such sacred odes as “White Christmas” and “Easter Parade.” Could we be sure his salute was sincere?

In her book, “God Bless America: The Surprising History of an Iconic Song,” coming in July from Oxford University Press, Sheryl Kaskowitz reveals that the seventh-inning stretch is far from the strangest occasion that “God Bless America” has turned up on since its premiere in 1938. Irving Berlin originally wrote “God Bless America” as a peppy interventionist ditty in the vein of George M. Cohan’s “Over There,” for “Yip, Yip, Yaphank,” a 1918 revue that included among its sundry delights a blackface number and a drag routine — all performed by a cast of American soldiers. But he cut the song from the show before opening night, concluding that having uniformed men who’d proved their patriotism through military service sing “God Bless America” would be “gilding the lily.”

Berlin dug “God Bless America” out of the wastebasket in 1938 after radio superstar Kate Smith (Kaskowitz describes her as “the Martha Stewart and Oprah Winfrey of her era”) asked him for a patriotic song to sing on her show for Armistice Day. With a couple of tweaks to the chorus and a new introductory verse, Berlin transformed the World War I song into something more like the pacifist anthem he’d told one reporter he’d like to write: “a great marching song that would make people march toward peace.”

Berlin fans may be surprised to learn that one of the great songwriters of the 20th century was a tinkerer for whom, at least in the case of this particular song, editing was as important as inspiration. Kaskowitz includes Berlin’s early drafts of “God Bless America” in her book, and a companion website with streaming audio recordings of Smith’s early performances illustrates further how both the composer’s adjustments and the singer’s interpretative choices shaped the overall effect of the work.

The 1918 version featured an awkward, bugle-like leap of a fourth in the first line, and it would take at least two revisions for Berlin to smooth the final statement of “America” into its resolute stepwise descent. As for that bit about the foam — well, it’s always been in there, first as the wartime plea “Make her victorious on land and foam” and then as the more neutral “Keep watching over her on land and foam” (you can tell he meant “sea” but needed the rhyme for the big finish). Finally, Berlin rewrote the second section of the chorus, replacing a repetition of the melody from the first line with the swelling sequence — and the catalog of geological wonders — that we know today.

Other revisions were politically motivated: A Belarusian Jewish immigrant who grew up in a Yiddish-speaking household, Berlin did not fail to notice that the premiere of “God Bless America” in the United States coincided with Kristallnacht in Germany. As fascism gained strength in Europe, he changed a line about guiding America “to the right” to “through the night,” and sometime before the sheet music was copyrighted, in 1939, the overtly isolationist line “Let us all be grateful that we’re far from there” became the more generic “Let us all be grateful for a land so fair.” For Berlin, the terror in Europe must have seemed close at hand. Kaskowitz quotes from the memoir of Mary Ellin Barrett, the eldest daughter of Berlin and his Catholic wife. She wrote that her parents worried that the “Germans would win” and “make an arrangement” with the United States. “And if that happened[,] how would they protect their half-Jewish children?”

Though Berlin once wrote to a critic that he “made no great claims for the merit of the song itself,” his emotional 1939 performance of “God Bless America” (a gem also included on the book’s website) suggests that the song may have meant more to him than he let on. Singing in his Lower East Side-inflected baritone, Berlin forgoes Smith’s martial pomp in favor of gentle, jazzlike piano accompaniment. It is as though, Kaskowitz notes, he’s singing a love song to the country that sheltered and embraced him. As he utters the phrase “home sweet home,” his voice cracks.

Whatever “God Bless America” meant to Berlin personally, it “seemed to be everywhere” by 1940, Kaskowitz writes. The Brooklyn Dodgers played it at every home game that year, and both the Democrats and the Republicans incorporated it into their conventions and campaigns. Woody Guthrie, fed up with what he viewed as the song’s complacent assurances, fired back with “God Blessed America,” the biting parody that would become “This Land Is Your Land.” Several anti-Semitic groups predictably targeted “God Bless America” as evidence of an imagined Jewish conspiracy, though the pro-Nazi German American Bund embraced the tune for a time at its New Jersey retreat — “that is,” Kaskowitz writes, “until they called for a boycott of the song upon discovering that it was written by a Jew.”

After the war, “God Bless America” was used briefly as a protest song by groups ranging from veterans breaking up a Communist Party rally in 1947 to civil rights workers sitting at lunch counters in Texas in the early 1960s. But by the mid-’60s the song had begun an inexorable rightward drift, becoming a staple of pro-Vietnam War rallies and of demonstrations by whites against integration. Kaskowitz notes that because “God Bless America” was 20 years old at its premiere, it had always been known as an “old song.” For an aging generation faced with the polarizing war and youth-driven social upheaval of the 1960s, it stirred nostalgia for the unified patriotism of the World War II era. She writes, “If conservatives can be understood as revolutionaries reacting against the progressive social change movements of the 1960s, then ‘God Bless America’ was their ‘We Shall Overcome.’” The song’s conservative associations stuck: Richard Nixon sang “God Bless America” with an 88-year-old Berlin at a state dinner in 1973, and Ronald Reagan, who famously used the song’s title phrase in his speeches, aligning himself as a hero of the emergent Christian Right, awarded Kate Smith the Presidential Medal of Freedom in 1982. Even today, sports fans in favor of the song’s continued use at baseball games are likely to describe themselves as “conservative” or “religious,” according to an online survey that Kaskowitz conducted. The bipartisan embrace of “God Bless America” immediately after 9/11 turned out to be short-lived.

But politics aside, Kaskowitz views the story of “God Bless America” as emblematic of a broader cultural shift: the striking decline of public singing over the course of the second half of the 20th century. In the decades since Berlin wrote it, she notes, Americans have become much less likely to gather and sing not just “God Bless America,” but any song at all. Gone are the musical rallies of the 1940s and the protest songs of the 1960s. Barack Obama’s historic journey to the White House was fueled by tuneless chanting of “yes we can,” and the soundtrack to the Occupy Wall Street movement was the spoken word of the “people’s mic.” Even “God Bless America,” Kaskowitz suggests, like the “Star-Spangled Banner” before it, has recently become an artistic vehicle for virtuosic soloists who ornament their performances with trills and appoggiaturas that discourage ballpark crowds from singing along.

Still, Kaskowitz is careful to temper nostalgia for a time when clashing protest groups faced off and sang “We Shall Overcome” and “God Bless America” at each other with reminders that rousing songs can also be used to silence dissent. In one example, she describes an incident from 1991 in which a group of congregants at a church service that George H.W. Bush was attending in Maine sang “God Bless America” to drown out a speech by a demonstrator opposed to the first Iraq War. Her warnings put me in mind of the time a German friend of my father’s attended our family’s Independence Day party and watched with undisguised horror as we sang “The Battle Hymn of the Republic” — thinking about, perhaps, Hitler’s chilling embrace of mass music.

Because music is powerful, it is dangerous — and so we must remain vigilant, of course, against politically coercive uses of patriotic songs. And yet that’s no reason to skip the sing-along at this year’s Fourth of July picnic. A rousing anthem can deafen us to healthy debate or unite us in a common cry for justice, or, as our congressmen demonstrated on 9/11, give voice to a common prayer for healing and peace. The trick is learning to tell the difference. And to do that, you’ve got to get used to the sound of someone singing in your ear.

Eileen Reynolds is a frequent contributor to the Forward.