Image copyright Reuters Image caption From the opening moment of the debate the two candidates attacked one another's records

It was the first Democratic debate in more than a month, and it comes on the eve of a New York primary that could either cement Hillary Clinton's lead or give the Bernie Sanders campaign a new, fighting chance at the nomination.

In other words, there was a lot on the line when the two candidates took the stage in Brooklyn on Thursday night.

Here are four things we learned after a contentious two hours of head-to-head political brawling.

1. Playtime is over

From the opening moments of the debate, the two candidates were at each other's throats. Mr Sanders backed away from earlier statements questioning Mrs Clinton's qualifications to be president, but he derided what he said was her lack of judgement.

"I question a judgement which voted for the war in Iraq, the worst foreign policy blunder in the history of this country, voted for virtually every disastrous trade agreement which cost us millions of decent-paying jobs," Mr Sanders said. "And I question her judgment about running super-PACs which are collecting tens of millions of dollars from special interests, including $15m from Wall Street."

Image copyright AFP Image caption The conflict in Iraq, in 2004 (left) and 2014 (right), still haunts Clinton

Mrs Clinton responded by pointing to Mr Sanders' poorly received interview with the New York Daily News last week.

"Talk about judgment and talk about the kinds of problems he had answering questions about even his core issue, breaking up the banks," she said. "I think you need to have the judgment on day one to be both president and commander-in-chief."

The sharper tone - which stands in stark contrast to earlier, more genteel debates - shouldn't come as much of a surprise, of course. Both candidates, and their supporters, have been ramping up their rhetoric for weeks now.

And while the language stayed above-board during Thursday's debate, it was hardly a picnic. "If you're both screaming at each other," debate moderator Wolf Blitzer said during one heated exchange, "the viewers won't be able to hear either of you."

2. A doer against a dreamer

Media playback is unsupported on your device Media caption Bernie Sanders supporter: "We need bold ideas"

The overarching theme of the debate, once again, was the difference between Mr Sanders' progressive idealism and Mrs Clinton's political pragmatism.

"It's easy to diagnose the problem; it's harder to do something about it," Mrs Clinton said at one point. She dismissed a piece of environmental legislation that Mr Sanders "introduced that you haven't been able to get passed".

On topic after topic, from the environment to health care to financial reform, Mrs Clinton cautioned that big ideas were fruitless without realistic chances of implementation.

More on Bernie Sanders

Who is he? How the self described "Democratic socialist" has shaken up the Democratic race

17 things Sanders believes: The Vermont senator in his own words

The billionaire vs the socialist: How he compares with the other key outsider candidate, Donald Trump

Mr Sanders, for his part, continued to paint in broad strokes: "History has outpaced Secretary Clinton," he said of her support for a $12/hour national hourly minimum wage when many in the party are rallying behind $15.

When asked about global warming, he said: "We've got to get beyond paper right now. We have got to lead the world in transforming our energy system."

Transformation. Revolution. Radical truths. It's the rhetoric that has fuelled Mr Sanders campaign success, and he's not backing down now.

3. Sanders still vulnerable on guns

Image copyright AP

Gun control is the one issue where Mrs Clinton can batter Mr Sanders from the left, and she did so once again on Thursday. She pointed out that she and her opponent have "a serious difference", and when the Vermont senator let out a chuckle, she pounced.

"It's not a laughing matter," she said. "Ninety people on average a day are killed or commit suicide or die in accidents from guns; 33,000 people a year. I take it really seriously, because I have spent more time than I care to remember being with people who have lost their loved ones."

Mrs Clinton went on to criticise Mr Sanders for voting against a key gun-control law in the 1990s and supporting legislation that would shield firearm manufacturers from lawsuits by victims of gun violence.

"We hear a lot from Senator Sanders about the greed and recklessness of Wall Street, and I agree we've got to hold Wall Street accountable," Mrs Clinton said. "Well, what about the greed and recklessness of gun manufacturers and dealers in America?"

Image copyright Reuters Image caption Hillary Clinton attacked Bernie Sanders over his record on gun control

Mr Sanders responded by noting that he receives a negative rating from the National Rifle Association - and making a pitch as someone who could break through the acrimony in the gun debate.

"Because I come from a state which has virtually no gun control, I believe that I am the best qualified candidate to bring back together that consensus that is desperately needed in this country," he said.

That's probably not enough to satisfy a Democratic Party that wants action, not conciliation, after every high-profile episode of gun violence in the US.

4. Foreign policy differences

Mrs Clinton's 2003 vote to authorise the Iraq War may haunt her for the rest of her political career. It cost her dearly in her nomination race against Barack Obama in 2008, and Mr Sanders has brought it up again and again in 2016.

On Thursday night he linked it to her support for US military action in Libya in 2011 and said it was part of a hawkish pattern.

"The New York Times told us it was Secretary Clinton who led the effect for that regime change," he said of Libya. "And this is the same type of mentality that supported the war in Iraq."

Image copyright Reuters Image caption Bernie Sanders criticised Hillary Clinton over her support for the US interventions in Iraq and Libya

Mrs Clinton explained that the US did the best it could in Libya, but the nation would not allow western ground troops to secure the peace after Muammar Gaddafi was killed.

"The Libyan people deserve a chance at democracy and self-government," she continued. "And I, as president, will keep trying to give that to them."

She added that the current chaos in Syria is a result of the US not taking firm action early to remove Bashar al-Assad from power before the civil war spun out of control.

How do Sanders and Clinton compare?

The two also clashed on Israeli-Palestinian relations, with Mr Sanders saying that Israel's response to attacks launched from Gaza was "disproportionate".

"I believe the United States and the rest of the world have got to work together to help the Palestinian people," he said.

Mrs Clinton countered: "I don't know how you run a country when you are under constant threat, terrorist attacks, rockets coming at you. You have a right to defend yourself."