The United States is an exceptional country, and it stands as a shining city upon a hill as a model of freedom to the rest of the world.

That’s the message that American politicians from John F. Kennedy to Newt Gingrich to Hillary Clinton have preached over the past six decades, using, as illustration and proof, what they and scholars have called one of the founding documents of the nation.

The document, “A Model of Christian Charity,” was written, the story goes, as a lay sermon delivered by John Winthrop, the elected governor of a community of Puritans, to his followers in 1630 on a small wooden ship in the mid-Atlantic as they headed into the unknown of the New World. Its key sentences come near the end:

“For we must consider that we shall be as a city upon a hill; the eyes of all people are upon us. So that if we shall deal falsely with our God in this work we have undertaken and so cause him to withdraw his present help from us, we shall be made a story and a byword through the world.”

In “As a City on a Hill,” Princeton University scholar Daniel T. Rodgers, an expert on the history of social ideas, writes that the story of Winthrop’s words “has been celebrated not only for its elements of drama — dangerous ocean passage, inspired words, and exalted sense of purpose — but as the origin story of the nation that the United States was to become.” Indeed, the first sentence of that quotation became the touchstone of the presidency of Ronald Reagan, who embedded the idea so much into the nation’s consciousness that it has become a staple of patriotic speeches ever since.

However, as Rodgers notes, “It is an uplifting story and a haunting one. And it is at least half wrong.”

In fact, my reading of “As a City on a Hill” is that just about everything about Winthrop’s words has been twisted and tortured so much out of shape and turned inside out to the point that it has come to signify the opposite of its original meaning.

Consider that the “city on a hill” words are often used directly or indirectly as an endorsement of the superiority of American capitalism. Yet Winthrop’s essay was a long meditation of how to balance God’s law of mercy with God’s law of justice. It was, writes Rodgers, a “running critique of economic materialism” and employed “some of the most anti-materialistic lines of Jesus’ parables.”

Consider, too, that much of the drama associated with the words doesn’t fit the facts. Rodgers points out that the essay might have been written in 1629 or 1630 and that there is no contemporary evidence that it was given as a sermon on shipboard. And, even if it had been, it would have been heard only by a small percentage of the community’s nearly 1,000 members since they were spread out in 16 ships. Indeed, there is no proof that Winthrop ever publicly read the “sermon” to his followers.

Far from being a “founding document” like the Declaration of Independence, Winthrop’s “Model” was virtually unknown during its own era and not rediscovered until two centuries later.

Rodgers’ superlative book is an intellectual page-turner — a muscular examination of the culture and theology behind the “Model,” a cogent study of the methods by which a nation gives itself meaning through the inventive interpretation of documents from the past and a sharp-eyed accounting of how Winthrop’s “city on a hill” phrase came to be used in modern political parlance.

One compelling wrinkle in the narrative is how Reagan’s speechwriters took the two-sentence section from the “Model” that their candidate, and later president, had used many times in the past, and lopped off the second sentence. They also added “shining” to the phrase to craft an image of the United States as a beacon of hope and freedom to the world.

Reagan, however, had included the second sentence initially as a warning that all the hope implicit in the American vision could be for nothing if the United States failed to live up to its promise. By the time he was president, his speechwriters decided to emphasize the positive and ignore the negative.

Yet, in that sense of warning, Reagan was much closer to Winthrop’s thoughts and worries. Far from seeing themselves as a beacon, his Puritans felt themselves to be naked to their critics, to their own self-censure and to God.

They ran the risk, Winthrop warned, that, failing to live up to their ideals, they would be “made a story and a byword through the world” — a story and byword of pride, failure and sin. They had nowhere to hide.

Patrick T. Reardon is the author of eight books, including the poetry collection “Requiem for David,” and is completing a history of the impact of the elevated Loop on Chicago for Southern Illinois University Press.