Sen. Kamala Harris has skyrocketed to the top of the Democratic field in recent weeks, but got a taste of the flipside of being at the front of the pack during the second round of Democratic debates on July 31.

Harris is drawing on her history in law enforcement to brand herself as a no-nonsense "progressive prosecutor," the best poised to directly take on President Donald Trump in 2020.

But while Harris' prosecutorial training has helped her expertly take down her rivals, her nearly 30-year long record as a prosecutor has proven to be a double-edged sword in her quest for the presidency.

At the debate, Rep. Tulsi Gabbard of Hawaii directly confronted Harris over her record of cracking down on nonviolent crime and fighting to keep prisoners suspected of having been wrongfully convicted locked up.

Visit Business Insider's homepage for more stories.

Sen. Kamala Harris has skyrocketed to the top of the Democratic field in recent weeks, but got a taste of the flipside of being at the front of the pack during the second round of Democratic debates on July 31, when she weathered attacks from all sides over her career as a prosecutor.

Harris, who has served as the junior senator from California since 2016, entered the race in January 2019 to a great deal of fanfare. In her relatively short time in the Senate, Harris made a name for herself with her pointed and aggressive questioning of nominees that come before the Senate Judiciary Committee.

The California senator previously served as California's attorney general and the district attorney of San Francisco and is drawing on her history in law enforcement to brand herself as a no-nonsense "progressive prosecutor," the best poised to directly take on President Donald Trump in 2020.

While her level of support and buzz around her campaign stagnated for a few months, she saw her poll numbers and fundraising surge with a targeted attack on former Vice President Joe Biden over his long and controversial record on racial justice issues, including his vehement opposition to busing as a tool of integration.

The week before the debate, Biden discussed his work with infamously pro-segregation Senators at a fundraiser, saying, "I was in a caucus with James O. Eastland. He never called me 'boy,' he always called me 'son,'" Biden said. "Well guess what? At least there was some civility. We got things done."

Read more: 'It was hurtful to hear you talk': Kamala Harris denounces Joe Biden's work with pro-segregation senators in tense exchange

At the June debate, Harris put her prosecutorial chops on display and strategically knocked down Biden, one of her top rivals among the Democratic primary electorate and among the critical bloc of African-American voters.

"I do not believe you are a racist, and I agree with you when you commit yourself to the importance of finding common ground, but it's personal and it was hurtful to hear you talk about the reputations of two United States senators who built their reputations and career on the segregation of race in this country," she said.

"There was a little girl in California who was part of the second class to integrate her public schools and she was bused to school every day," Harris added. "That little girl was me. So I will tell you that on this subject, it cannot be an intellectual debate among Democrats."

But while Harris' prosecutorial training helps her expertly take down her rivals, her nearly 30-year long record as a prosecutor has proven to be a double-edged sword in her quest for the presidency.

Harris' controversial history is coming to light

Despite breaking barriers as a woman of color in the legal system, Harris has been heavily scrutinized over her own history as a tough prosecutor, which included everything from defending the death penalty, controversial criminal penalties for truant parents, and ignoring possibly exculpatory evidence in wrongful conviction cases.

In an in-depth July feature for Reason magazine, journalist Elizabeth Nolan summarized Harris' record as speaking of "racial justice and liberal values" but at the same time, fighting "for more aggressive prosecution not just of violent criminals but of people who committed misdemeanors and 'quality of life' crimes."

And in a January New York Times op-ed, law professor Lara Bazelon excoriated Harris' record, writing, "Harris fought tooth and nail to uphold wrongful convictions that had been secured through official misconduct."

While Harris has largely avoided being directly confronted over her record on criminal justice, Rep. Tulsi Gabbard of Hawaii flipped the switch.

Read more: 'You owe them an apology': Tulsi Gabbard ripped into Kamala Harris at the Democratic debate over her controversial record on criminal justice

"I'm concerned about this record of Senator Harris. She put over 1,500 people in jail for marijuana violations and laughed about it when she was asked if she ever smoked marijuana," Gabbard said (A fact-check from the San Francisco Chronicle found that Harris' number of successful marijuana prosecutions during her tenure as AG was closer to 2,000).

Gabbard continued to run through a list of the thornier parts of Harris' record, saying, "she blocked evidence that would have freed an innocent man from death row. She kept people in prison beyond their sentences to use them as cheap labor for the state of California, and she fought to keep cash bail system in place that impacts poor people in the worst kind of way."

In her critique, Gabbard was referring to the case of Kevin Cooper, a man convicted of a quadruple-murder in 1983 and sentenced to death row. Harris initially refused to use advanced DNA testing to determine whether he had been wrongfully convicted until New York Times columnist Nicholas Kristof wrote a long feature about the case last year. California's Governor Gavin Newsom has since ordered new DNA testing to take place, and Cooper remains on death row.

And in 2014, Harris' office wrote a memo arguing that the release of low-level offenders in California prisons "would severely impact fire camp participation," a program in which prison inmates fight wildfires. Her campaign told the Daily Beast that Harris was "shocked and troubled" attorneys in her office made that argument and told them not to argue the position in the future.

Democratic presidential hopeful US Representative for Hawaii's 2nd congressional district Tulsi Gabbard. Jim Watson / AFP / Getty

Harris is finding she can't have her cake and eat it too

Harris, clearly taken aback by Gabbard's attack, gave a vague defense of her record full of buzzwords without addressing any of the specific cases or points Gabbard brought up.

"I did the work of significantly reforming the criminal justice system of the state of 40 million people which became a national model," Harris said, adding, "I am proud of making a decision to not just give fancy speeches or be in a legislative body and give speeches on the floor, but doing the work of being in the position to use the power that I had to reform a system that is badly in need of reform."

"When you were in a position to make a difference and an impact in these people's lives, you did not," Gabbard shot back. "There's no excuse for that and the people who suffered under your reign as a prosecutor, you owe them an apology."

Harris' rebuttal to Gabbard didn't come until after the debate, when she slammed the Hawaii congresswoman over Gabbard's controversial 2017 meeting with Syrian dictator Bashar al-Assad, and her refusal to condemn him as a war criminal who, among things, is accused of using chemical weapons on his own citizens.

Read more: Kamala Harris and Tulsi Gabbard went after each other without mercy in Detroit. Both had a point.

While Harris was smart to point out Gabbard's own questionable history on fundamental issues of justice, she didn't give a satisfactory answer or explanation to many of the critiques of her record that Gabbard raised.

At the beginning of the debate, Harris also stumbled in defending her healthcare plan, which would implement a government-run Medicare for All healthcare system over a 10-year timeline with a role for private insurers to compete in it, against criticisms from Biden that it would rely on successor implementing it and lead to tax increases.

And Harris' own controversial history on the matter meant she couldn't attack Biden over the decades-long tough-on-crime crusade he pursued as a member of the US Senate, ceding that ground to Sen. Cory Booker, who successfully took Biden to task on his role pushing punitive criminal justice legislation.

If Harris is running for a president as a "progressive prosecutor," there's no doubt her rivals will begin zeroing in on the issues raised by Gabbard, Bazelon, and Nolan Brown, including criticisms that she covered up misconduct by a corrupt lab technician, fought to keep other possibly wrongful convicted prisoners locked up, aggressively prosecuted cases under California's three-strikes law, and cracked down many nonviolent and 'quality of life' offenses, including truancy and sex work.

There's still about six months to go before the first votes in the Democratic primary are cast, but Harris is finding that as her stature in the field is rising, she can't have it both ways when it comes to criminal justice.

Read more:

CNN anchor Don Lemon confronted Kamala Harris at the Democratic debate over her previous statements saying that if she's president, she'll have the DOJ prosecute Trump

Kamala Harris once pushed for steeper cash bail costs, saying 'people come to San Francisco to commit crimes because it's cheaper to do it'

Here are the winners and losers of night 2 of the 2020 Democratic presidential debates in Detroit