A few years back, writing about Bob Dylan and the 1960s, I came across an odd attitude among Britons who presumed they knew about America.

This was long before Charleston. It was long before the connection between young black Americans and the euphemism "arrested-related death" became stark.

It amounted to a kind of litany. Something like: Dr King, the March on Selma, KKK, "We Shall Overcome", Malcolm X, LBJ, the Civil Rights Act. The British caricature was of a problem long since solved. The Oath of Allegiance - "With liberty and justice for all" - and all those constitutional amendments had been vindicated, so it seemed, back in the monochrome, protest-song days.

Many Americans wanted to believe it too. Incarceration and unemployment rates for black men were one thing. An economic and educational apartheid was no cause for boasting. But still: there were laws, stern and revered. Equality before those laws was beyond doubt. There was, finally, a national inhibition governing language. It amounted to a kind of test.

In Dylan's early days even august organs of East Coast liberal opinion would talk of "the Negro problem". What they meant was a problem for white America. But all that was gone, surely? In the 21st century, use of the N-word was restricted to the descendants of slaves, and even then it was contested. American attitudes to race were embedded in American speech. It was not the worst compromise.

Some Tea Party clown might turn up to glare at Barack Obama while flaunting an assault rifle, but that was the mad exception, not the rule. The old Confederate Stars and Bars was just - so adherents insisted - "heritage". Institutional racism was a thing of the past. America was not to be judged by its unravelled fringes but by its constitution and its devotion to progress. Certain interested readers of my efforts, British and American, stuck to this view.

Dylan, for such is part of his gift, always knew better. In 2012, just before Mr Obama's election, the singer observed that his country is "just too f****d up about colour". Dylan called it "the height of insanity". Then, as usual, he said something prescient: "Blacks know that some whites didn't want to give up slavery - that if [whites] had their way, they would still be under the yoke. And they can't pretend they don't know that."

Charleston has concentrated minds. It has caused Mr Obama to be compared, for oratory, to Kennedy, FDR, and Lincoln. It has made Europeans think, if they had not thought before, about the gulf between American idealism and American realities. It has presented the people of the republic with an improvised morality. If, despairingly, they can do nothing about the National Rifle Association (NRA), they can at least do something about that Confederate flag.

History will probably call it typically American. History will probably attest that only in the United States could nine black worshippers be slaughtered in a church just as the Supreme Court was preparing to strike a thunderous blow for human freedom. Nine dead in the Emanuel African Methodist Episcopal Church in the heart of the old South; marriage equality for all gay people in every state in the Union. You could call that a contrast.

America supplies a profusion of those. The most powerful nation on the planet, still proclaiming itself a beacon for all, is a puzzling creation. It puzzles anyone who is not American. Often enough, it puzzles Americans themselves. The point might be that we are confused for different reasons. The distinction is not trivial.

Early in 2012, even after four years in the White House, Mr Obama was still opposed, publicly, to same-sex marriage. In that year, just six states allowed gay people the same rights in marriage as any aged billionaire drawing up a "pre-nupt" contract. The speed of progress has been dizzying. It is as though Americans have looked at one another and made a simple moral choice. A majority on the Supreme Court has nodded agreement.

Last year, nevertheless, more Americans died because of guns than because of road traffic accidents. Anyone who knows anything about the country and its cars will know that the fact isn't incidental. Yet while Mr Obama can stand in the Emanuel church and deploy intensely moving words, while he can sing "Amazing Grace" with heart-stopping fervour, he knows what he can't do about guns.

It's a simple fact. In this, the NRA is more powerful than "the most powerful man on earth". Money and firepower are joined. Even if the will in Washington existed, there is the sense, barely voiced, that a challenge to a spurious right bestowed, supposedly, thanks to the Second Amendment would cause mayhem. Some of those who are armed itch for their patriotic fight. They're not kidding.

An optimist could find a few consolations. Despite Charleston and all the other slaughters, gun ownership in the US is actually declining. The General Social Survey, the best guide there is, estimates the number of households containing firearms at 32 per cent. In Britain, we might find the statistic grisly and disturbing. Back in 1980, fully 50 per cent of American men owned a gun.

Optimism is tempered by the fact that those who are armed tend to have armouries. One weapon, it seems, is never enough. A president mourning nine dead in a church shooting has not the authority, legal or political, to begin to do anything about the fact. But you might still detect a kind of progress: better than two thirds of Americans decline to be armed.

From the one third, nevertheless, you derive a Dylann Roof, confessed perpetrator of the massacre of nine people. His posed photographs with his Stars and Bars have been seen around the world. His belief in "white supremacism" is not disputed. He bought his Glock, it seems, just as normal folk would. And he decided that 39 million of his fellow Americans were his enemies because of the colour of their skins.

Racism is not confined to America. That's hardly the point. The US lays claim to a moral authority, to democratic credentials, to match its wealth and faltering power. When its Supreme Court liberates gay people, or upholds the small reforms called Obamacare, you can grant what America likes to call "leadership". When a Dylann Storm Roof turns up, conclusions cease to be obvious.

What's obvious from the outside is hard, often enough, for Americans to say. Mr Obama has been a weak president in many respects, but that isn't why so many "on the right" loathe him. He's a black man. In the White House. And Bob Dylan's views on the nature of his country, the reality untouched by self-policed language, remain accurate. For some - for how many? - a black man in the Oval Office is unthinkable. Nine murdered in a church is thinkable.

Do black people have authentic civil rights in such a country? Dr King might have despaired. Should the rest of us, with bigots enough of every colour and creed, defer always to America when it ignores reality and propounds idealism? The reality is ugly as sin, the ideals unsurpassed. That's puzzle enough.