LOS ANGELES — It was the kind of affirmation that candidates covet, especially in the year of the 99 percent: a woman who lost her home to foreclosure stood up at a campaign rally to thank the candidate for supporting her lawsuit against a mortgage company.

“The gratitude of the community is unbelievable,” Tsvetana Yvanova told California attorney general and U.S. Senate candidate Kamala Harris. When Yvanova went to the California Supreme Court for the right to sue New Century Mortgage Corp., Harris filed a brief on her behalf and the court ultimately ruled in Yvanova’s favor.

“Thank you for your courage,” Harris replied, basking in the opportunity to remind the roughly 150 people who came to see her at the United Food and Commercial Workers hall that standing up to the mortgage industry on behalf of homeowners has been a hallmark of her tenure as the top law enforcement officer of the most populous state in the nation.

Harris’s profile as a crusader for the down-and-out seems to match the moment — a year of populist anger against Washington insiders and a “rigged system,” spearheaded by presidential candidates Donald Trump and Bernie Sanders. Harris has led in the polls since announcing her candidacy for the seat of retiring Sen. Barbara Boxer (D) and is expected to easily emerge from the June 7 Senate primary.

But even in deep blue California, Harris may have a tougher race in the general election.  The state’s unusual primary system pits all candidates — Republicans, Democrats, independents and minor parties — in the same contest, meaning the top two vote-getters regardless of party will advance to the general election. Harris could find herself in a November showdown with another Democrat: 20-year House veteran Loretta Sanchez, who hails from Orange County in southern California and is poised to place second in the primary fight.

On Monday, Gov. Jerry Brown threw his weight behind Harris in a somewhat unusual step as the governor only chooses to wade into a handful of contests.

A Sanchez-Harris face-off in the general election would ensure the seat is still occupied by a female Democrat.  The winner will likely make history as Harris, 51, whose father is Jamaican and mother is South Asian, would be the only black woman in the Senate and Sanchez, 56, the daughter of Mexican immigrants, would be one of the first Latinas. Catherine Cortez Masto, a Democratic Latina running for Sen. Harry Reid’s (D) open Nevada seat, could also win in November.

But such a battle could be contentious in a key state and test the power of key minority constituencies in a year when the Democratic presidential nominee is counting on Latinos and African-Americans to win the White House.

An unabashed progressive, Harris is perfectly poised to capitalize on the anti-establishment sentiment driving many voters to the polls this year. That message has lifted Donald Trump and Sen. Bernie Sanders, a self-avowed democratic socialist, in their races (though Hillary Clinton is the presumptive Democratic nominee).

Harris, however, has endorsed Clinton; her younger sister, Maya Harris, is a senior policy adviser to the Clinton campaign. Sanchez has not endorsed either Democrat.

The presidential primary is also June 7, and Sanders is locked in a tight battle with Clinton for the state’s 475 delegates. Neither Democrat has chosen sides in the Senate primary. California’s current senators also have stayed out of the race, but Harris has been endorsed by Sens. Cory Booker (N.J.) and Kirsten Gillibrand (N.Y.), along with several House members from California. Sanchez has the backing of 17 of her fellow House members.

Shortly after she became California attorney general in 2011, Harris made national headlines by balking at the terms of a proposed settlement between the federal and state governments and five large mortgage companies to provide relief to California homeowners hit by the foreclosure crisis.

She refused to sign off on the deal, arguing that the $4 billion offered to California was too low and provided too much immunity to the big banks. Critics accused her of grandstanding, but in the end, Harris won more than $20 billion in relief and additional legal protections for California homeowners.

On the campaign trail, Harris has championed comprehensive immigration reform with a path to U.S. citizenship for undocumented immigrants, an increase in the federal minimum wage and paid family leave, stances that have won her support from labor unions, women’s groups, LGBT activists and environmentalists. Sen. Elizabeth Warren, the progressive icon from Massachusetts, in a new campaign television ad, calls Harris “fearless.”

“She is a superstar,” said Robert Garcia, the mayor of Long Beach, who has endorsed Harris in the Senate race. “She has dedicated her life to social justice.”

Sanchez has touted her experience — she notes that she is the only candidate who has first-hand knowledge of how Congress works, and she especially points to her membership on the House Homeland Security and Armed Services committees.

Sanchez shrugged off being passed over by the Los Angeles Times, which endorsed Harris. “In that endorsement they sort of indicated that I’ve been doing a great job, but it’s just the military. What people don’t realize is the military is incredibly important to California and national security is going to be a big issue for voters. I think they just missed the boat on that one,” Sanchez said. Fifteen other California papers have endorsed the congresswoman, her spokesman said.

If there is a criticism of Harris, it is that she is sometimes too cautious, declining to take a position on some controversial issues, by saying that she sees herself as “Fearless, yes. Reckless, no.”

And to those who think she is too ambitious, she doesn’t completely disagree: “I have always had an ambitious policy agenda. I eat no for breakfast.”

In her 2003 campaign for San Franciso district attorney, Harris staked out controversial ground by opposing the death penalty. Months into her job, she refused to seek the death penalty against a man accused of killing a San Francisco police officer. Her decision brought condemnation from law enforcement groups and elected officials, including Feinstein.

But Harris stood her ground.

Rep. Karen Bass, whose district is based in Los Angeles, said Harris “took what everybody said was a career-ending position” in that case. But she said Harris remained popular by being “smart about her job. She proved that being smart on crime did not mean soft on crime.”

A former California Assembly speaker, Bass said she appreciated that Harris brought a refreshing perspective to law enforcement. “She was not just a black woman DA, but a black woman DA who wasn’t going to go about her job by saying ‘How many people can I lock up so I can get reelected’.”

In 2010 Harris ran for attorney general, defying the odds to beat a popular Republican Los Angeles County prosecutor by a narrow margin: she won by 74,000 votes out of more than 9.6 million. Since then, her name has been mentioned as a future candidate for higher office.

The future arrive last year, when Boxer announced she would not run for reelection. Harris declared her candidacy almost immediately and other A-lists Democrats, including Gavin Newsom, current lieutenant governor and former San Francisco mayor; and Antonio Villaraigosa, the former mayor of Los Angeles, decided to take a pass.

Harris has raised more than $9 million, three times as much as Sanchez, but her poll numbers have remained at or just under 30 percent for much of the past year. Her campaign drew critical news reports for excessive spending and last fall she replaced her campaign manager.

Kevin Spillane, a Republican consultant whose candidate lost the 2010 attorney general’s race to Harris, said Harris should be doing better in the Senate race. “I’ve been surprised, honestly, that her campaign and performance has been much weaker than expected,” Spillane said. “Maybe as time passes she can grow into this potential star chatter that she receives, but she seems more strong on style than on substance.”

After her remarks at the union hall, Harris took a few questions. One person asked whether she, a denizen of the Bay Area, would pay attention to Southern California. Harris said that although San Francisco is home, she had recently moved to Los Angeles, where her husband, Douglas Emhoff, runs the West Coast offices of the national law firm Venable.

“I’m a Sangeleno!” she quipped to the delight of the crowd, staying behind after her remarks to share lingering hugs with older women and posing for selfies with younger fans.

During a brief interview, Harris said she wanted to go to the Senate to have a national on platform to push for issues that she is passionate about, including criminal justice and immigration reform.

“On the issue of immigration, we have the largest population of immigrants, documented and undocumented. This problem has to be solved and for California not only is it about civil rights, but it is also about the economy,” she said.

But Republicans have criticized Harris for supporting sanctuary cities, where local law enforcement do not arrest or detain people for being undocumented immigrants. Specifically, they have cited the murder last year of a San Francisco woman by a who was in the country illegally, an incident that Trump has highlighted in his speeches.

Harris has responded by criticizing Republicans “for conflating criminal justice policy with national immigration policy.”

“It is irresponsible to craft public policy for 12 million people around our collective outrage at the actions of one individual,” she said, drawing applause at the Los Angeles rally.

Yvanova, the plaintiff in the state Supreme Court case, said she’d never met or even talked to Harris before the event.

She said Harris struck her as “personable, very approachable — but a lot more powerful than she appears to be. Behind that smile is a very big determination and erudition.”

“I know for a fact that everybody who has a home will support her.”