Democratic presidential candidates Hillary Clinton and Bernie Sanders reunited in Brooklyn, N.Y. on April 14 for a contentious CNN debate ahead of the New York primary. Here are the most contentious moments from that debate. (Sarah Parnass/The Washington Post)

Hillary Clinton and Sen. Bernie Sanders traded testy accusations and open scorn over policy differences and personal judgment in a debate Thursday that put on full display just how much the once-genteel Democratic presidential contest has turned ugly.

Days before the all-important New York primary, the longtime front-runner and the persistent underdog did little to disguise the resentment and dislike that have taken root as Sanders has eroded Clinton’s national lead and laid claim to a hold on the Democratic Party’s populist heart.

Sanders opened the session by charting the startling success of his insurgent campaign. The reason for it is simple, he said: “We’re doing something pretty radical; we’re telling the American people the truth.”

Clinton fired back that Sanders has demonstrated that his own qualifications for the job are thin — and cited an interview with the New York Daily News editorial board in which he stumbled over how he would accomplish a signature goal of breaking up big banks.

The tension, which crossed over to open hostility, was apparent from the first moments of the debate. Well before the halfway point of a two-hour broadcast, the candidates had accused each other of being unprepared, misguided and confused and had engaged in a shouting match where each refused to cede the floor to the other.

“If you’re both screaming at each other, the viewers won’t be able to hear either of you,” CNN moderator Wolf Blitzer scolded.

Heading into the crucial New York primary Tuesday, Clinton holds a commanding double-digit lead here in several polls, although both campaigns have suggested that the race in New York may be much tighter.

Clinton is hoping to deal Sanders a decisive defeat that effectively quashes his argument that he still has a plausible chance to capture the Democratic nomination.

The stakes for Sanders are even higher. He badly needs a solid showing in New York to sustain his claim that he can catch up to Clinton’s lead among both pledged delegates and Democratic superdelegates, the Democratic Party leaders and elected officials who can cast a vote at the national convention for any candidate they choose.

New York is the biggest prize of the Democratic race so far, with 247 delegates at stake.

With time running short, Sanders was fiercely critical of Clinton and willing to be far more provocative than in the previous eight debates. He accused her of using a “racist” expression when she said, as first lady, that some young black youths were “super-predators.”

“Everybody knew it was a racist term,” Sanders said.

The Washington Post's Dan Balz asks what Brooklyn means to the people on the campaign trail ahead of CNN's Democratic presidential debate on April 14. (Dan Balz/The Washington Post)

Clinton has apologized for using the expression.

Both candidates ducked and weaved when presented with tough questions about parts of their records and positions that are at odds with progressives in the party.

Sanders struggled to defend a vote to grant immunity to gun dealers and manufacturers but also sought to express sympathy for the victims of the Sandy Hook school shootings in Connecticut, who are pressing their case in court.

Clinton stood by her advocacy of a $12 federal minimum wage — less than the $15 Sanders advocates — yet touted her support from unions that take Sanders’s position.

Both candidates struggled to square their support of a 1996 crime bill that liberals in their party blame for a large increase in the jail population — which both of them repeatedly have spoken out against on the campaign trail.

Sanders zinged Clinton for giving paid speeches to Wall Street firms and suggested she is beholden to the financial industry.

Pressed to cite an example of Wall Street’s influence on Clinton during her tenure as senator, Sanders said “the obvious response” to the financial sector’s excesses would be to support breaking up the banks, as he has. But he didn’t cite a specific piece of legislation, instead turning to a common line of attack on the campaign trail.

“Secretary Clinton was busy giving speeches to Goldman Sachs for $225,000 a speech,” Sanders said, referring to speeches given following her departure from the State Department.

“He cannot come up with any example, because there is no example” of her doing the bidding of Wall Street, Clinton said, adding that she had “called out” wrongdoing. “It may be inconvenient, but it’s always important to get the facts straight,” she said.

Sanders mocked her answer.

“Secretary Clinton called them out? Oh, my goodness, they must have been very upset by this,” he said sarcastically.

Clinton glared, as they both did throughout the debate, then sought to turn the tables by noting that she had released decades of tax returns but Sanders has not followed suit.

Sanders said he would release his full 2014 tax returns on Friday and asked for understanding for not doing so sooner.

“Jane does our taxes,” Sanders said, referring to his wife. “We’ve been a little bit busy lately. You’ll excuse us.”

Sanders said there would be no major revelations.

“They are very boring tax returns,” he said. “Not big money from speeches, no major investments.”

Previously, Sanders has only released part of his 2014 return.

One of the sharpest exchanges occurred over gun control, with Clinton accusing Sanders of helping gun manufacturers get unique legal protections. They also clashed over climate change, with Clinton saying that Sanders has unrealistic notions about what can be done within the confines of the U.S. political system. She accused Sanders of discounting progress that President Obama has made on both fronts.

“It’s easy to diagnose the problem. It’s harder to do something about it,” she said.

Sanders did not back off his criticism of Verizon or General Electric during the debate.

There are some good corporate citizens, he said. “Verizon happens not to be one of them.”

He also went after GE chief executive Jeffrey Immelt, saying: “He has outsourced hundreds of thousands of decent-paying jobs throughout the world.”

The crowd was rowdier and more partisan than at past debates, with supporters of each candidate clapping and cheering, sometimes nearly drowning out the speakers. Both candidates directly engaged the audience at times — and also each other, sometimes turning to face off as they gave their answers.

“I love being in Brooklyn,” Clinton said with a grin as her supporters cheered.

The debate at the redeveloped Brooklyn Navy Yard took place on ground both candidates can claim as home. Sanders was born in Brooklyn, and as his candidacy caught fire his distinctive Brooklyn accent has become fodder for late-night television humor. He frequently invokes his path from the three-room, rent-controlled apartment where he grew up as a classic American tale.

Clinton represented New York for eight years in the Senate and has called herself a New Yorker since she and former president Bill Clinton bought a house in suburban Westchester County 16 years ago. Her campaign headquarters is in Brooklyn, a short distance from the debate site.

A Gallup poll released Thursday showed that, while 66 percent of Democrats viewed her favorably, 30 percent did not. The gap between those two numbers, which Gallup calls Clinton’s “net favorability,” was smaller than it had been at any time since last July. When the race began, Clinton’s net favorability was 63 percent.

Sanders has won seven of the last eight state contests in this race. But because those states were small — and because Democrats split their delegates proportionally — he remains behind Clinton in the race for “pledged” convention delegates. Clinton now has 220 more of those delegates than Sanders.

Sanders was scheduled to leave immediately after debate for a trip to the Vatican, where he is booked to speak at a conference on income inequality on Friday. He has also expressed hope that he will get to meet the pope, though the Vatican has said nothing is scheduled.

The trip has drawn criticism for coming so close to a crucial primary, but Sanders’s aides say they have worked to minimize the time he will spend off the trail. Sanders is scheduled to be back in New York by early Saturday afternoon. He is planning large-scale rallies both Monday and Tuesday.

Sanders told The Post on Wednesday that he would be “kicking myself forever” if he passed up an opportunity to take part in a discussion at the Vatican focused on the core message of his campaign and broader political career.

Sanders’s aides also argue that he will be away from New York no more than Clinton will be for planned fundraisers for her campaign. She has a pair of events scheduled in California with actor George Clooney and his wife, Amal.