There was a time when Bernie Sanders, the stiff, white senator from Vermont, seemed painfully out of place in black churches. But not now at the end of the long primary trail, and not here at the Allen Temple Baptist Church.
Summoning congregants last week inside a historic East Oakland sanctuary that gave rise to the civil rights movement and the Black Panther Party, Sanders spoke passionately about the plight of many blacks: Too many children are raised in poverty, too many youths can't afford to go to college and can't find jobs, too many adults are locked in jails. The system is rigged against them, and he vowed to change it.
The audience rose in applause and affirmation. There were hurrahs and smiles and shouts of "Amen!" At last, Sanders had convinced African-Americans that he understood their story - and, at last, they seemed to understand his.
Only it was too late. By the time Sanders showed up here, he had effectively lost his chance to be president. Even an unexpectedly lopsided win in Tuesday's California primary would almost certainly not be enough to stop front-runner Hillary Clinton from clinching the Democratic nomination.
For all that Sanders has achieved - turning a protest movement into a viable run, gaining mainstream acceptance for his democratic socialist views, pioneering a new way to fund campaigns, and pushing his adopted Democratic Party to the left on trade, Wall Street and other issues - his campaign for president is also a story of might-have-beens.
Since March 15, roughly the midway point in the primary season, Sanders has fought Clinton to a draw - he has won about as many contests and almost the same number of pledged delegates as Clinton. A comeback victory in California, a state with demographics that have favoured Clinton elsewhere, would be another triumphant second-half win that would make it even harder for Sanders to accept defeat.
"Bernie didn't grow up thinking he was going to be president," said former Vermont Governor Howard Dean, a Clinton supporter. "To come as close as he has, it's damn hard to let go."
According to interviews with the candidate, his advisers, allies and other Democrats, Sanders fell short because of missed opportunities, a failure to connect with key constituencies and stubborn strategy decisions.
THE MAIN PROBLEMS
1 Slow start
Perhaps the campaign's biggest mistake was not realising early on that Sanders could win. That led to a slow start, both in building the infrastructure needed to run a national campaign and in Sanders' own presence among voters who knew little about him.
"I don't think anybody had figured out how to win when we got in," said senior strategist Tad Devine. "It was, 'How do we become credible?' "
2 Voter groups and officials
As it became clear that Sanders was gaining credibility, though, he struggled to connect with black and Latino voters, as well as with older Democrats, groups that carried Clinton's candidacy. Sanders repeatedly clashed with another vital constituency - the party leaders whose votes as superdelegates he would ultimately need to pry the nomination away from Clinton.
3 Message and contrasts
Sanders also overestimated the power of his economic message and, adamant that he run the kind of positive campaign that had been his trademark in Vermont, initially underestimated the imperative to draw sharp contrasts with Clinton.
"His economic message has been pretty powerful - so powerful that you feel elements in what Hillary is saying now," said David Axelrod, chief strategist on President Barack Obama's 2008 and 2012 campaigns. But, he said, "there's a story about this old blues player, Papa John Creach. One guy says, 'He has only one riff,' and his friend goes, 'But it's a great riff.'
"Bernie is Papa John Creach," Axelrod continued. "He's got a great riff but doesn't have a lot of variety."
Late last year, as part of his effort to establish himself among black voters, Sanders led the media on a walking tour of the impoverished Baltimore neighbourhood of Freddie Gray, the black man whose death in police custody had sparked rioting in the city.
Sanders encountered boarded-up row-houses, corner stores with bars on the windows and rubbish strewn about the streets. He was trying to show that he gets it, but his comments instead underscored the different world he and wife Jane inhabit in Vermont, a rural state that is 95 per cent white.
Describing the scene before him as a "third-world country," Sanders said that, "a few blocks away from where we live, there's a very nice grocery store, a supermarket. We buy good quality food, produce, at a reasonable price. You don't have that here."
Sanders had a personal connection he could have shared with black voters - he attended the March on Washington in 1963 and got arrested while protesting against school segregation in Chicago - but he was initially reluctant to open up about it.
Nina Turner, a former Ohio state senator who campaigned for Sanders across the country, said she pleaded with Sanders to talk more about his own history in the civil rights movement. "Tell your story, and weave it into your platform," Turner said she told him. But she said her advice was not always heeded: "He doesn't like talking about himself."
The first big test of Sanders's appeal to African-Americans came in late February in South Carolina.
He hired staff members to coordinate African-American outreach. He aired ads on black radio stations. He deployed an eclectic group of high-profile validators, including former NAACP head Benjamin Jealous, scholar Cornel West, rapper Killer Mike and actor Danny Glover. But nothing seemed to work - and Sanders wasn't connecting on his own.
"Bless his heart, I don't think he has been around people of colour a lot," said Gilda Cobb-Hunter, a prominent black state senator in South Carolina who stayed neutral in the primary. "I saw him speak, and he didn't slow down. He didn't read his audience - body language, faces, a certain cadence. No slowing down to receive or acknowledge affirmation or an 'Amen' here or there. He was brusque. He didn't appear to feel comfortable - and it showed."
Justin Bamberg, among a half-dozen black state legislators who supported Sanders in South Carolina, said, "It was an uphill battle from the beginning," made worse by the fact that Sanders did not do enough retail politicking. "That's just how things are down here," Bamberg said. "It makes it seem like you care enough to visit, and that can go a long way."
Then there was Sanders's message. His diagnosis for what ails the country is essentially a one-size-fits-all overarching sense of economic injustice. But many Democrats, particularly African-Americans, say race also factors heavily into the economic plight of blacks.
"How deeply the rules of the game are slanted against people of colour - that was an element that he had to figure out how to do more with," Dean, a former Democratic National Committee chairman, said. "His core is fighting for working-class people, a classic class analysis. But race is just as big a deal in this country."
Sanders got crushed in South Carolina, losing 73 per cent to 26 per cent. The margin would be similar in a string of Southern primaries that quickly followed, cresting with a 66 point loss in Mississippi in early March. Sanders was never likely to win in the South against the Clintons and their long history with African-American voters, but it was those enormous margins that allowed the former Secretary of State to build an insurmountable delegate lead.
In the 15 states that have already voted and that have a larger proportion of African-Americans than the United States as a whole - most of them in the South - Clinton has won 353 more pledged delegates than Sanders. In the other 34 contests, Sanders had won 78 more pledged delegates than Clinton, as of Sunday.
"Clearly, we did very poorly in the South," Sanders said in an interview. "There's no ifs, ands or buts about that."
He said that his appeal to African-Americans has improved as the campaign has continued, but he attributed that to voters' being more familiar with him rather than anything he has done differently.
Turner said his performance among fellow African-Americans "keeps me up at night". She said that Sanders's economic and criminal-justice proposals clearly would benefit African-Americans but that Sanders needed more time to become a known commodity.
"He's coming into his own now," she said, "but it's June."
Part of Sanders' strategy to win heavily African-American states was to win the three that came before them: Iowa, New Hampshire and Nevada. The Sanders team reasoned that they had a shot in all three and that running the table would provide momentum and buzz and, in the words of Devine, would "open the door" in the South.
Nonetheless, Sanders did not go all-out for months after his April 2015 announcement. Aides said he felt strongly about maintaining his workload in the Senate, so trips to Iowa, New Hampshire and other states were mostly confined to long weekends.
At first, Sanders also eschewed retail politics. Sometimes after campaign rallies, Sanders made a beeline to his car rather than sticking around to greet voters one-on-one or posing for selfies. By contrast, Clinton sprinkled roundtable discussions and meet-and-greet visits to coffee shops throughout her itineraries.
Sanders sought to create momentum by drawing huge crowds to rallies, many in liberal cities that were far afield from the early-voting states. His aides argued that the news coverage justified the strategy for such an unknown candidate, but others said it cost him where the first votes would be cast.
"I think that the gigantic rallies were seductive to the Sanders campaign, but they don't translate in Iowa as well as the conference-table discussions," said Jerry Crawford, a veteran Iowa Democrat who chaired Clinton's state campaign.
Nonetheless, by December, a little over a month before the Iowa caucuses, the Sanders team started to sense that they could win the kickoff contest, Devine said.
The Clinton campaign soon sensed it, too. Specifically, it saw one number in Ann Selzer's poll for the Des Moines Register and Bloomberg Politics that spooked them. Two weeks before the caucuses, 43 per cent of likely caucus-going Democrats described themselves as socialists.
"That meant that all Bernie had to do to win the Iowa caucuses, literally, was get 7 per cent of everyone else who didn't call themselves a socialist," Crawford said. "To me, it's still a miracle that he didn't."
When the Sanders campaign aired an ad in which Sanders says, "It's called a rigged economy, and this is how it works," Clinton allies sensed more trouble. Jeff Link, who ran Obama's campaigns in Iowa, said he called Clinton's state director, Matt Paul, and said, "Dude, you've got a problem."
In the end, Clinton eked out a victory by 0.3 per cent of the vote. It was an unexpectedly strong showing for Sanders, but it wasn't enough to fundamentally alter the Democratic race or overcome the near non-stop media focus on Donald Trump and the Republican nomination battle. Clinton's victory had been built precinct by precinct over nine months. By caucus day, Sanders had hired his own army of staff and organised in all 99 counties, but it was too late to catch up.
"There was a path for Senator Sanders to win ... but it would have needed near-perfect execution and a worse candidate than Hillary Clinton," said R.T. Rybak, vice-chairman of the DNC and a former Minneapolis mayor.
Inside the Sanders campaign, a common lament was that there were not enough days on the calendar. Sanders' wife, Jane, a political strategist in her own right, said as much as she talked to reporters aboard her husband's campaign plane after the first string of states.
"I would have liked to have had more opportunity to just camp out down in South Carolina, so they could know him," she said. "That wasn't an option. ... We needed to be in Iowa, we needed to be in New Hampshire, we needed to be in Nevada, then we needed to be in South Carolina. It's just timing. Time was the enemy for this part."
One of the biggest adjustments Sanders made between his early losses and his later wins was to start attacking Clinton with gusto.
What had started as an early point of pride for Sanders, that he did not go after Clinton, eventually gave way to an aggressive effort to contrast their positions, question Clinton's judgment, and knock her for accepting six-figure speaking fees from Wall Street firms and for refusing to release transcripts of those remarks.
Some Sanders allies say adopting the tougher posture sooner could have made a real difference - putting Clinton on her heels and bringing to fore more of the vulnerabilities that are now weighing down her favourability ratings.
"Running for office is about attention," Turner said. "It doesn't have to be going for someone's jugular, but you need to draw the contrasts. I wish he had started off that way."
Burt Cohen, a former New Hampshire state senator who served on Sanders' steering committee there, said Sanders could have been more aggressive about highlighting Clinton's ties to the moderate wing of the party in a year when base voters wanted a progressive nominee. "But he is who he is," Cohen said of Sanders. "He's a gentleman, and he was hesitant to go after Hillary."
Squaring off for the first Democratic debate in October, Sanders famously declared that people were "sick and tired of hearing about your damn emails," a reference to the drumbeat of news coverage about Clinton's use of a personal email server while she was secretary of state. The remark was widely lauded and seen as a sign of Sanders' authenticity, but Turner said that moment also "set the stage in some people's minds that he wasn't a fighter".
Devine said that "the initial calculation was from him, that we shouldn't talk a lot about the peripheral issues having to do with the Clintons". That meant that the email controversy and questions about the Clinton Foundation were largely off-limits.
The Sanders team also calculated that, had he attacked her early, he would have invited an equally aggressive posture from Clinton and her allies, including a well-funded super PAC.
Campaign manager Jeff Weaver disputed the suggestion that Sanders should have gone negative on Clinton sooner. "You have to introduce yourself to voters for them to understand who you are and what you stand for," he said. "You can't start a campaign by drawing contrasts."
The remaining question for Sanders is how he plans to end his campaign. Sanders insists that he will not drop out on Wednesday when California and five other states vote, even if a combination of pledged and superdelegates makes it clear that Clinton has claimed the nomination. The final Democratic contest is the following Wednesday in the District of Columbia. And he is vowing to press ahead to the Democratic National Convention in July in Philadelphia.
Sanders hopes to persuade enough of the 718 superdelegates - elected officials and other party elites not bound by the outcome of the contests in their states - to switch their votes. His argument: Polls show him performing better against Trump in head-to-head matchups than Clinton.
It is painfully ironic for Sanders that his fate will be determined by the Democratic establishment with which he has zealously sparred throughout his congressional career. Axelrod recalled attending Senate Democratic caucus meetings where Sanders, an independent who caucused with the Democrats, was a loner.
"Bernie would always be off by himself," Axelrod said. "He was with them and not of them. In certain ways, that's worked for him here. Having been in Congress for 25 years, he can credibly claim not to be part of the establishment. But that can be costly when you have to count on the establishment to buoy your candidacy."
As of this weekend, 547 superdelegates had publicly announced support for Clinton, while Sanders could claim the backing of only 46.
Sanders' effort is considered a long shot if not an impossibility by most political observers, but Sanders said getting even this far was once seen as equally implausible.
"When we started the campaign, people didn't know Bernie Sanders or what our agenda was," said Sanders, who originally budgeted US$30 million to US$50 million but so far has raised and spent more than US$200 million. "This campaign has done what many people thought was impossible."
Ralph Nader, a former Green Party presidential candidate who, like Sanders, has operated as a leftist outside the two-party system, said the normalising of socialism has been one of Sanders' biggest achievements. "Socialism used to be a no-no word," Nader said. "He has brought the word into the mainstream and made class distinctions central to his campaign. He's ended the taboo."
As Sanders travelled in his Secret Service motorcade between campaign stops in California, he said he is not looking back.
"My focus is today," he said, "and not worrying about what I could have done six months ago."