Democratic presidential primary front-runner Joe Biden ran into a formidable challenge at Thursday night’s debate from Sen. Kamala Harris, who tapped into her prosecutor toolbox to put his race record on trial following controversy over his comments on segregationist senators.

While the other top-polling candidate on stage in Miami, Bernie Sanders, avoided any direct clash with the former vice president, the California senator made a point of confronting Biden on the issue that has rattled his otherwise high-flying campaign.

SWALWELL ZINGS BIDEN ON AGE AT DEBATE

In perhaps the most heated moment of the night, Harris told Biden she doesn’t believe he is a “racist” but considers his recent comments about being able to work with segregationist senators early in his career “hurtful.” (Biden has said he disagreed with the senators on segregation, but was still able to work with them in the Senate).

“You worked with them to oppose busing,” Harris then said, referring to efforts to limit orders for school desegregation by busing. In an emotional moment, she told her own story of being bussed as a little girl in California.

Biden fired back that Harris’ comments were a “mischaracterization of my position across the board,” saying he never praised racists, while denying that he opposed busing. He insisted he opposed busing ordered by the Department of Education, as opposed to localities making their own decisions.

Adamantly defending his record on race and civil rights, he also swiped at Harris by noting he became a public defender -- not a prosecutor, as she was.

CANDIDATES VOW TO COVER ILLEGAL IMMIGRANTS IN HEALTH CARE PLANS

The clash amounted to one of several moments where Harris grabbed attention, including when she scolded her rivals after they were shouting over one another in an earlier skirmish. “America does not want to witness a food fight,” Harris said. “They want to know how they’re going to put food on their table.”

With 10 candidates on stage, just like the previous night's showdown in Miami, the moderators frequently had to step in as well to stop them from talking over one another.

Biden, though, for the most part kept his focus on the candidate he really wants to face -- President Trump -- while repeatedly invoking the name and record of his popular running-mate Barack Obama and brushing back swipes at his age from long-shot candidate Rep. Eric Swalwell, who repeatedly called on him to "pass the torch."

"I'm still holding onto that torch," Biden said with a grin.

It's unclear whether the clash with Harris might damage Biden, considering most prior controversies have not dinged his poll numbers -- or simply give her some needed momentum in a race where fellow Sen. Elizabeth Warren, on stage the night before, has been climbing.

Sanders, for his part, spent much of the NBC-hosted debate defending his big-government agenda against questions from moderators and criticism from more centrist – and lower-polling – candidates.

Early in the debate, Sanders dismissed a moderator's contention that nominating a democratic socialist could re-elect Trump, pointing to polls showing him ahead of the president in head-to-head matchups.

“The American people understand that Trump is a phony,” Sanders said. “Trump is a pathological liar and a racist and that he lied to the American people during his campaign. He said he was going to stand up for working families.”

But several rivals took issue with some of Sanders’ socialistic policies, like "Medicare-for-all" and free college tuition.

Former Gov. John Hickenlooper of Colorado took issue with his rivals embracing socialism, saying it’s not good politics.

“I think that the bottom line is if we don't clearly define we are not socialists, the Republicans are going to come at us every way we can and call us socialists,” Hickenlooper said.

Colorado Sen. Michael Bennet challenged Medicare-for-all, saying the public should be able to have a choice on health care, public option or otherwise.

And South Bend Mayor Pete Buttigieg broke with Sanders in saying while he supports free college for children of low and middle income, “I just don’t believe it makes sense to ask working-class families to subsidize even the children of billionaires.”

Harris was also pressed on how Democrats will pay for the massive programs they are proposing, but tried to turn the tables on Trump instead.

“I hear that question, but where was that question when the Republicans and Donald Trump passed a tax bill that benefits the top one percent and the biggest cover corporations contributing to the debt of America which middle-class families will pay for one way or another,” Harris asked.

California Rep. Swalwell was the first to go on offense against Biden, recalling a speech Biden gave years ago saying it’s time to pass the torch to a new generation.

“Joe Biden was right when he said that 32 years ago. He is still right today. If we are going to solve the issue, pass the torch,” Swalwell said.

The debate also made clear how Democrats have moved to the left on issues relating to immigration.

"One of the worst things about President Trump that he's done to this country is he's torn apart the moral fabric of who we are," said New York Sen. Kirsten Gillibrand.

All 10 Democrats raised their hands when asked if their government health care plan would cover illegal immigrants.

“That’s the end of that race!” Trump tweeted as he panned their response.

"All of the Democrats tripped over each other in a race to see who could stand out as the most leftist candidate, threatening government control of every aspect of people’s lives," his campaign said in a statement.

At another point, most candidates raised their hands when asked if they support decriminalizing crossing the border without authorization – a vibrant topic in the debate the night before. Candidates also said they did not think someone whose only offense is coming to the United States illegally should be deported.

“Let's remember that's not just a theoretical exercise, that criminalization is the basis for family separation,” Buttigieg said.

Biden said he didn’t want to see immigrants deported whose only offense is coming to America without documents.

“That person should not be the focus of deportation,” Biden said. “We should change the way we deal with things.”

Buttigieg – who has struggled to attract black voters – entered the debate having to answer questions about the racial unrest back home in South Bend, as the city deals with a deadly police-involved shooting.

“I'm not allowed to take sides until the investigation comes back,” he said. “The officer didn't have his body camera on. It's a mess. We are hurting.”

The debate stage included two non-politicians with national followings – entrepreneur Andrew Yang and writer Marianne Williamson.

“The right candidate will be solving the problems that got Donald Trump elected,” Yang said. “I am that candidate, I can build a much broader coalition to beat Donald Trump.

“Mr. President if you're listening, I want you to hear me, please," Williamson said. "You've harnessed fear for political purposes and only love can cast that out."

It was the second of two NBC sponsored debates this week, the first being Wednesday night. The network split up 20 of the Democratic candidates over the two nights.

The Wednesday night debate reflected how the party has moved to the left on issues of immigration, taxes and abortion. The candidates who debated Wednesday were: New York Mayor Bill de Blasio, New Jersey Sen. Cory Booker, former HUD Secretary Julian Castro, former Maryland Rep. John Delaney, Hawaii Rep. Tulsi Gabbard, Washington Gov. Jay Inslee, Minnesota Sen. Amy Klobuchar, former Texas Rep. Beto O’Rourke, Ohio Rep. Tim Ryan and Massachusetts Sen. Elizabeth Warren.

Fox News’ Brooke Singman contributed to this report.