When she announced her campaign for president before a crowd of 20,000 in Oakland on Martin Luther King Jr. Day, Sen. Kamala D. Harris (D-Calif.) offered an electrifying account of how and why she entered public service.

“It was just a couple blocks from this very spot that nearly 30 years ago as a young district attorney I walked into the courtroom for the very first time and said the five words that would guide my life’s work: ‘Kamala Harris, for the people.’ ” she said.

Harris seemed to have it all — charisma, experience and the tantalizing prospect of seeing a woman, and a woman of color no less, sit behind the big desk in the Oval Office for the first time.

Even the campaign calendar seemed to be declaring that this would be Harris’s moment in history.

California, a state where it is impossibly expensive to compete from a standing start, had moved up its primary to March. Who better to take advantage of that than a woman who had already won there three times statewide, barely breaking a sweat in the 2016 Senate election that she carried by more than 20 percentage points?

What this former prosecutor lacked, however, was the thing that was most important of all: a theory of the case.

She was dazzling in a Senate hearing room — who could forget her blistering interrogation of Attorney General William P. Barr in May, in which she exposed the sheer implausibility of Barr’s denials that he had undermined the investigation by special counsel Robert S. Mueller III into Russia’s interference in the 2016 presidential election?

But as a presidential candidate, she was uncertain and clumsy, starting with her fumble on health care. First, she declared that she would eliminate private insurance, then she reversed herself. It revealed how little grounding she had on the issue that Democratic voters say is their top priority.

Harris also waffled between embracing her record as a prosecutor and downplaying it. She cycled through palate-pleasing slogans — among them, “the 3 a.m. agenda” and “justice is on the ballot.” But they did not add up to a vision.

The problem was not that she didn’t have positions on the issues. She had plenty of them, on topics from teacher salaries to equal pay for men and women, gun control, taxes and immigration. But given the choice of going left or going right, Harris too often seemed to be trying to choose both.

Her debate performances had a similar quality. She came out swinging at front-runner Joe Biden in her first outing, challenging the former vice president’s record on school desegregation and citing the opportunities that she had been afforded as a child who went to a better school thanks to a busing initiative. But she sank back when Biden pointed out that there was little difference between their positions on the issue, and polls indicated her attack on Biden had alienated some Democratic voters.

That kind of caution might have made her a more viable candidate in a general election, but in a crowded Democratic primary field, she fought to be noticed. Her poll numbers went into a long decline.

Harris’s decision to depart the race two months before the first contest in Iowa came as a surprise but not a shock. Her campaign organization was a mess, and she said she lacked the financial resources to continue. By getting out before the filing deadline for the California primary, she also spared herself what would likely have been a humiliation in her home state.

Still, with her departure, the top tier of the Democratic field is all-white, and except for South Bend, Ind., Mayor Pete Buttigieg, a trio of septuagenarians. Harris would no doubt be on the shortlist of potential running mates for whoever gets the nomination.

“Although I am no longer running for president,” she said in her announcement, “I will do everything in my power to defeat Donald Trump and fight for the future of our country and the best of who we are.”

High expectations, as Harris has learned, are not necessarily a blessing. But by knowing when to make an exit, she has preserved the possibility that, at some point down the line, she might still turn them into a reality.

Read more: