Senator Kamala Harris of California dropped out of the Democratic presidential race on Tuesday after months of low poll numbers and a series of missteps that crippled her campaign, a deflating campaign for a barrier-breaking candidate who was seeking to become the first black woman to win a major party’s presidential nomination.

The decision came after weeks of upheaval among Ms. Harris’s staff, including layoffs in New Hampshire and at her headquarters in Baltimore, and disarray among her allies. She told supporters in an email on Tuesday that she lacked the money needed to fully finance a competitive campaign.

“My campaign for president simply doesn’t have the financial resources we need to continue,” Ms. Harris wrote. “But I want to be clear with you: I am still very much in this fight.”

The announcement is perhaps the most surprising development to date in a fluid Democratic presidential campaign where Ms. Harris began in the top tier. Her departure removes a prominent woman of color from a field that started as the most racially diverse ever in a Democratic primary, and raises the prospect that this month’s debate in Los Angeles will feature no candidates who aren’t white.

Ms. Harris opened her campaign on Martin Luther King’s Birthday with a rousing speech in her hometown, Oakland, Calif., before an audience of 20,000 people, drawing comparisons to history-making black politicians like Barack Obama and Shirley Chisholm.

In addition to the financial troubles, some of Ms. Harris’s supporters worried that a poor showing once voting began, particularly in the California primary, would leave Ms. Harris vulnerable to a Senate primary challenge in 2022.

Presidential candidates have dropped out after running out of money for decades, including Senator Kirsten Gillibrand and former Representative Beto O’Rourke earlier this year. In 2015, Scott Walker, then the governor of Wisconsin, famously flamed out of the Republican contest months before balloting began because he was short on cash.

President Trump tweeted a farewell to Ms. Harris, saying, “We will miss you Kamala,” to which she replied: “Don’t worry, Mr. President. I’ll see you at your trial.’’