Imagine, for a moment, that George W. Bush had been president when the Transportation Security Administration decided to let Thanksgiving travelers choose between exposing their nether regions to a body scanner or enduring a private security massage. Democrats would have been outraged at yet another Bush-era assault on civil liberties. Liberal pundits would have outdone one another comparing the T.S.A. to this or that police state. (“In an outrage worthy of Enver Hoxha’s Albania ...”) And Republicans would have leaped to the Bush administration’s defense, while accusing liberals of going soft on terrorism.

But Barack Obama is our president instead, so the body-scanner debate played out rather differently. True, some conservatives invoked 9/11 to defend the T.S.A., and some liberals denounced the measures as an affront to American liberties. Such ideological consistency, though, was the exception; mostly, the Bush-era script was read in reverse. It was the populist right that raged against body scans, and the Republican Party that moved briskly to exploit the furor. It was a Democratic administration that labored to justify the intrusive procedures, and the liberal commentariat that leaped to their defense.

This role reversal is a case study in the awesome power of the partisan mindset. Up to a point, American politics reflects abiding philosophical divisions. But people who follow politics closely  whether voters, activists or pundits  are often partisans first and ideologues second. Instead of assessing every policy on the merits, we tend to reverse-engineer the arguments required to justify whatever our own side happens to be doing. Our ideological convictions may be real enough, but our deepest conviction is often that the other guys can’t be trusted.

How potent is the psychology of partisanship? Potent enough to influence not only policy views, but our perception of broader realities as well. A majority of Democrats spent the late 1980s convinced that inflation had risen under Ronald Reagan, when it had really dropped precipitously. In 1996, a majority of Republicans claimed that the deficit had increased under Bill Clinton, when it had steadily shrunk instead. Late in the Bush presidency, Republicans were twice as likely as similarly situated Democrats to tell pollsters that the economy was performing well. In every case, the external facts mattered less than how the person being polled felt about the party in power.