On 21 June 1964 three young civil rights activists, Michael Schwerner, James Chaney and Andrew Goodman, went to investigate the burning of a black church near Philadelphia, Mississippi. It was the Freedom Summer. Young idealistic and militant whites and blacks from north and south came to the state with the most vicious reputation for racial violence, to register black voters and challenge civil rights abuses. That afternoon, deputy sheriff Cecil Price stopped their car and took them in, ostensibly for a speeding violation. While they were in his custody he alerted local Klan members. When the men were released that night, Klansmen – organised by Edgar Ray Killen – followed them, murdered them and buried them in a nearby earthen dam.

Sixteen years later Ronald Reagan came to Mississippi, fresh from the Republican convention that nominated him as its presidential candidate, and spoke at the Neshoba County Fair, just a few miles away from where the men were killed. He said nothing about civil rights, the three who perished nearby or their open murder case, for which no one had been convicted, even though most in the town knew the culprit ("Hell, the Klan was boasting about it," Buford Posey, who once lived there, told me. Killen was finally convicted in 2005.)

Instead Reagan spoke in favour of "state's rights" – the rallying cry for confederate apologists who sought to defend each individual state's right to continue slavery. As messages go, it was as subtle as a Republican today starting a presidential campaign in Sanford, Florida – where George Zimmerman killed Trayvon Martin – with a speech mentioning gun rights and calling on the audience to "stand their ground" against a Democratic onslaught. Reagan narrowly won Mississippi. It would never return to the Democratic column again.

Lyndon Johnson knew there'd be days like these. The evening he passed the civil rights act, just 10 days after the murders, the journalist Bill Moyers wrote that he "found [Johnson] in a melancholy mood … I asked him what was troubling him. 'I think we just delivered the south to the Republican party for a long time to come,' he said."

As Reagan illustrated, Republicans accepted the delivery gladly. As predicted, white southerners abandoned the Democratic party en masse. Repelled by the party that deprived them of their most ostentatious racial privileges, they were also attracted by Republicans who sought them out through racially coded messages in what became known as Richard Nixon's "southern strategy". The realignment was pronounced and profound. In the 90 years before 1964, Republicans never won a majority of southern states; after 1964 they lost the former confederacy only once, in 1976 to Jimmy Carter, who was from Georgia.

But 50 years after Johnson signed the Ccivil rights act, Republicans have become victims of their own success. Their dominance of the south has mutated into dependency. The proportion of southerners in the House Republican caucus has grown steadily since 1976. As the Nation magazine's Ari Berman points out, when Republicans won the House in 1994 30% of their representatives were from the south; today it is 42%. This has shaped the party's trajectory in ways that have not just limited its ability to win national elections but crippled its ability to govern effectively even when it does win. Southern representatives comprise more than 60% of the Tea Party caucus, which has done more to embarrass the Republican leadership than the Democrats could ever do. Morally the southern strategy was always a bankrupt formula, contingent on pandering to bigotry and mobilising racial animus, but now it is less of a strategy than a liability. In the last six presidential elections, the Republicans have won the popular vote only once.

The most obvious explanation for this is racial demographics. In 1970, when white Americans comprised roughly 83% of the country, animating their grievances against non-whites could win; in 2010, when they make up 64%, it can't. Gerrymandering congressional districts has only aggravated the long-term problem. In 2000, the respected pollster Charlie Cook points out, "House Republicans represented 59% of all white US residents and 40% of all non-white residents." Today those figures are 63% and 38% respectively. "While the country continues to grow more racially diverse," writes Cook, "the average Republican district continues to get even whiter."

To court the south, the party has also made itself far more culturally conservative. The south is the most religious part of the US, and has by far the highest proportion of evangelical Christians. In the last election, Republicans won big among white born-again Christians (78%) and the devout (70% of white Protestants and 57% of white Catholics who attend church weekly). To keep these voters, they must maintain a hard line on abortion and gay marriage, alienating suburban women and young people across the country. White evangelicals are also the least likely to believe in evolution, encouraging the party's denial of basic facts and scientific evidence. The result is a party that is pale (in the 2012 presidential elections it won 59% of the white vote), male (52% of the male vote) and frail (it is most popular among those aged 65 and over). Given prevailing demographic trends, this is not a winning coalition.

By knowingly sacrificing long-term electoral gain in favour of principled legislation, Johnson set a presidential standard when he signed the civil rights act that has not been rivalled since. He was prepared to risk the future of his party, as the young that summer were prepared to risk their lives. Indeed, those two risks were symbiotic: it was the movement that made the legislation possible and the legislation that gave the movement the courage to continue. The politics of equality and integration that Chaney, Goodman and Schwerner set out to create may have proved elusive. But it outlived the politics of oppression and contempt that some consequently attempted to exploit, even if the three young men did not.

"If the civil rights movement is 'dead', and if it gave us nothing else, it gave us each other for ever," wrote Alice Walker in her first published essay The Civil Rights Movement: What Good Was It? "It gave us history and men far greater than presidents. It gave us heroes, selfless men of courage and strength, for our little boys and girls to follow. It gave us hope for tomorrow. It called us to life."