Former vice president Joe Biden and Sen. Kamala D. Harris both faced tough questions about their criminal justice records Wednesday night.

For Harris, the attacks focused on her time as attorney general of California.

For Biden, rivals zeroed in on his role passing tough-on-crime legislation as a senator from Delaware in the 1970s, 1980s and 1990s.

“Sir, you are trying to shift the view from what you created,” Sen. Cory Booker (N.J.), one of three black candidates, told Biden at one point. “There are people right now in prison for life for drug offenses because you stood up and used that tough-on-crime phony rhetoric that got a lot of people elected but destroyed communities like mine. This isn’t about the past, sir. This is about the present, right now.”

The exchange was one of several charged moments on race and criminal justice, which remain pivotal issues in the race for the 2020 Democratic presidential nomination.

“It continues to be a historic election when it comes to criminal justice reform,” said Udi Ofer, deputy national political director and director of the Campaign for Smart Justice at the American Civil Liberties Union. “Twenty years ago, Democrats were trying to outcompete each other on who could be tougher on crime. Today, they’re attempting to outcompete each other on who can be smarter on justice.”

Biden and Harris were not the only candidates who faced criticism. Biden went after Booker’s time overseeing police as mayor of Newark, and New York Mayor Bill de Blasio was accused of mishandling the case of Eric Garner, a black man killed during an encounter with city police officers in 2014.

Booker was the first to criticize Biden on Wednesday night, echoing his earlier attacks on Biden’s criminal justice overhaul plan, released last week. That proposal would undo virtually all the tough-on-crime policies Biden helped enact as a senator, such as mandatory minimum penalties and a sentencing disparity between crack and powder cocaine.

It would also eliminate the death penalty, which was expanded by several laws that Biden helped to pass.

On the debate stage, Biden defended the legislation he wrote as reflecting a political consensus around tough-on-crime policies in previous decades. Two of Biden’s most significant bills — the 1986 Anti-Drug Abuse Act and the 1994 Violent Crime Control and Law Enforcement Act — passed with support from most black lawmakers.

But Biden also pitched himself as a candidate who would pursue changes as president, highlighting his proposal to eliminate the remaining crack-powder sentencing disparity.

“I think that we should change the way we look at prisons,” Biden said. “Right now, we’re in a situation where, when someone is convicted of a drug crime, they end up going to jail, into prison. They should be going to rehabilitation.”

Biden accused Booker of failing to rein in the Newark police department when he was mayor from 2006 to 2013. The police force was investigated by the U.S. Justice Department in 2011 and subsequently came under federal oversight.

“Nothing happened the entire time you were mayor,” Biden said. “There was nothing done to deal with the police department that was corrupt.”

Booker said he implemented changes that were endorsed by civil liberties advocates, then pivoted back to Biden, saying that “all the problems that he is talking about . . . he created.”

“This is one of those instances where the house was set on fire, and you claimed responsibility for those laws,” Booker said. “And you can’t just now come up with a plan to put out that fire.”

Biden also went on the offensive against Harris, accusing her of failing to bring cases against school districts in Los Angeles and San Francisco, which he described as “two of the most segregated school districts in the country.”

Rep. Tulsi Gabbard (Hawaii) joined in, saying she was “deeply concerned” about Harris’s record. Among other issues, Gabbard accused Harris of prosecuting marijuana offenses, fighting to keep cash bail and pursuing other policies that disproportionately hurt people of color. “The people who suffered under your reign as prosecutor, you owe them an apology,” Gabbard said.

Harris, who is black, defended her record and portrayed herself as a leader who implemented changes while facing difficult decisions, such as whether to pursue the death penalty in certain cases.

“I dare anybody who is in a position to make that decision to face the people I have faced to say, ‘I will not seek the death penalty.’ That is my background. That is my work. I am proud of it,” Harris said. “I think you can judge people by when they are under fire. It’s not about some fancy opinion on a stage. But when they’re in the position to actually make a decision, what do they do?”

Oversight of police departments arose as another theme.

Julián Castro, a former secretary of housing and urban development, called for a national use-of-force standard for police and described himself as the “only candidate that has put forward a police reform plan.”

And early in the evening, several protesters targeted de Blasio with cries of “fire Pantaleo,” a reference to Daniel Pantaleo, the police officer accused of killing Garner with an illegal chokehold.

De Blasio said Garner’s family was “going to get justice” soon in New York City, referring to a coming decision from NYPD Commissioner James O’Neill about whether Pantaleo should keep his job.