Hillary Clinton gave the most powerful speech of her campaign so far in San Diego on Thursday, tearing into Donald Trump’s foreign policy ideas – such as they are – before a conspicuously presidential backdrop of no fewer than 19 American flags. But before she can get down to the dirty business of defeating the billionaire Republican in November, Ms Clinton still has another major obstacle to overcome in California: Bernie Sanders.

The progressive Vermont Senator, who also attacked Mr Trump on the stump in Modesto, California on Thursday, has dramatically narrowed the poll gap ahead of the state’s 7 June primary. An NBC/Wall Street Journal survey released this week put Ms Clinton at 49 and Mr Sanders at 47 per cent support among California’s likely Democratic voters. A new USC Dornsife/Los Angeles Times poll puts the pair just a single point apart – well within the margin of error.

Ms Clinton, now just a few dozen delegates short of the necessary 2,383 – including the party’s controversial so-called “super-delegates” – is expected to clinch the Democratic nomination early on Tuesday evening with a comfortable win in New Jersey, where she leads in polls by an average of more than 15 points.

But Sanders supporters believe an upset in California, which Ms Clinton was once predicted to win easily, would give them the moral weight to make their case at the Democratic convention in Philadelphia in July and force more of their candidate’s policy agenda onto the party platform.

California is the most populous state in the union, with an unmatched 546 Democratic delegates up for grabs. It is also the last state to vote in the 2016 primary season. A marginal win here for Sanders would do little to alter the overall arithmetic of the Democratic contest, but it could keep the question of the nomination open by a crack, just as Ms Clinton is trying to pivot to her looming general election battle against Mr Trump.

The former Secretary of State’s San Diego speech has catapulted her into a campaign swing through the Golden State, where she and former President Bill Clinton will appear at some 30 events between them in the next five days. Ms Clinton had intended to campaign in New Jersey on Thursday, but appears to be concerned by the closeness of the California race.

Mr Sanders has thrown all his remaining resources into California, holding large rallies up and down the state, which his campaign estimates will see him speak directly to almost a quarter of a million Californians before 7 June. The Modesto rally was his 28th California event since 9 May. “I wonder why Secretary Clinton and her husband Bill are back in California,” he joked to reporters this week. “I though we had lost it… but I guess Secretary Clinton maybe is looking at some polling that would suggest otherwise.”

The Clinton campaign is said to be rattled by the large number of newly registered independent voters in California – a group that has come out in force for Mr Sanders in other states. The Senator also remains strong among young voters here, including Latinos, the demographic that helped to drive Ms Clinton to victory over Barack Obama in California in 2008.

On Tuesday, the state’s Democratic Governor, Jerry Brown, endorsed the front-runner despite his bitter history with the Clintons, which goes back the the 1992 presidential campaign, in which he lost a bruising Democratic primary to Bill Clinton. In an open letter to fellow Democrats, however, he said it was urgent to halt Mr Trump’s “dangerous candidacy” and that this was “no time for Democrats to keep fighting each other.”

In a bid to heal party divisions, the Democratic National Committee (DNC) recently struck a deal with the Clinton and Sanders camps, giving Mr Sanders’s supporters a significant presence on the 15-person convention platform committee, which writes the party’s policy platform. Ms Clinton has picked six members of the committee, Mr Sanders five and DNC chairwoman Debbie Wasserman Schultz the remaining four.