Media playback is unsupported on your device Media caption Joe Biden's rambling answer about record players raised eyebrows - but who had the best one-liner?

Three frontrunners in the race to become Democratic Party candidate for US president have clashed over healthcare at the party's third debate.

The debate in Houston, Texas, was the first time Joe Biden, Elizabeth Warren and Bernie Sanders faced off on stage.

Former Texas lawmaker Beto O'Rourke drew some of the biggest applause with an impassioned plea for gun control.

The winner is likely to face President Donald Trump, a Republican, in the November 2020 poll.

Only the 10 highest-polling Democrats were eligible to take part in Thursday's debate.

Mr Biden, who served as vice-president under Barack Obama, is leading current polls by a considerable margin with Massachusetts Senator Ms Warren and Vermont Senator Mr Sanders in second and third. The rest of the field are polling in single figures.

As the debate was under way, President Trump told a Republican gathering in Baltimore that he now thought that Ms Warren had a chance of beating Joe Biden, referring to both by derisive nicknames.

The legacy of President Obama came up repeatedly, while there were also questions on immigration, climate change and gun control. But it was healthcare that sparked the fieriest clashes.

Why is healthcare controversial?

The issue of how to reform the US healthcare system has divided moderate and more progressive Democrats.

Mr Sanders and Ms Warren both back Medicare for All, which would expand an existing federal government programme for the elderly to cover all Americans.

This government-run healthcare system would be financed by taxes and be similar to what exists in Canada and many European countries, including the UK.

Image copyright Getty Images Image caption Democratic presidential hopefuls Bernie Sanders (left), Former US Vice-President Joe Biden (centre) and Elizabeth Warren

Mr Biden criticised Mr Sanders' Medicare for All plan as being too expensive to work and said the country should focus on improving Mr Obama's Affordable Care Act instead.

"I know the senator [Warren] says she's for Bernie. Well, I'm for Barack. I think Obamacare worked," Mr Biden said. "My plan costs a lot of money...but it doesn't cost $30tn (£24tn)."

Ms Warren defended the policy, saying families have to deal with exorbitant healthcare bills now, and only wealthier individuals and corporations would see increased costs from the plan.

Some of the lower polling candidates also attacked Mr Sanders and Ms Warren, with Minnesota Senator Amy Klobuchar saying of Medicare for All: "I don't think that's a bold idea. It's a bad idea."

How about gun control?

Former Texas congressman Beto O'Rourke, whose hometown El Paso was the site of a mass shooting that left 22 dead, was asked whether he supports confiscating assault-style rifles.

"Hell yes we're going to take your AR-15, your AK-47," Mr O'Rourke said to applause. "We're not going to allow it to be used against your fellow Americans anymore."

California Senator Kamala Harris drew President Trump into the debate, saying: "Obviously he didn't pull the trigger, but he's certainly been tweeting out the ammunition."

In their opening remarks most of the candidates attacked President Trump, blasting him for being a divisive leader and accusing him of racism.

What else happened?

Though some sparks flew there was also a lot of common ground between the candidates.

Media playback is unsupported on your device Media caption Andrew Yang's debate surprise - a giveaway to random families

Here are some of the other memorable moments:

Businessman Andrew Yang used his opening speech to announce he would be using donations to his campaign to start a "freedom dividend", giving $1,000 (£810) a month to 10 American families, prompting laughter from other candidates

New Jersey Senator Cory Booker, who is a vegan, was asked by a Spanish-speaking moderator whether he wanted Americans to stop eating meat to combat climate change. He replied: "First of all, I want to say, no. Actually, I want to translate that into Spanish: No."

Mr Biden gave a rambling answer about combating the legacy of slavery by getting into education, talking about keeping a "record player on at night [to] make sure that kids hear words"

Housing secretary under President Obama Julián Castro responded to South Bend, Indiana Mayor Pete Buttigieg's criticism that debate fighting was "unwatchable" by saying: "That's called an election"

Mr Castro also took on Mr Biden, accusing him several times of "forgetting what you said two minutes ago" in an exchange on healthcare. He later defended the remarks, telling the BBC it was not a personal attack on Mr Biden's memory but rather reflected a disagreement over policy

Immigration rights protesters entered the hall at one point, interrupting Mr Biden as he responded to a question on resilience by talking about coping with the loss of his first wife and children

Mr Buttigieg, the first openly gay presidential candidate, spoke about coming out in his final remarks, saying: "I was not interested in not knowing what it was like to be in love any longer."

Unlike the two previous debates, Thursday's event took place over one night as only 10 candidates fulfilled the stricter polling and donor requirements. Ten others remain in the race, and four have dropped out.

The Democratic National Convention, at which the presidential nominee will be formally chosen, will take place in July 2020 after a series of state primary elections and party caucuses starting in February.

President Trump was at an annual retreat for House Republicans in Baltimore as the debate took place.

"I hit Pocahontas way too early. I thought she was gone," he said, referring to Elizabeth Warren, who has in the past made controversial claims about having Native American ancestry.

"She's emerged from the ashes and now it looks like she could beat Sleepy Joe, he's fallen asleep. He has no idea what the hell he's doing or saying."

Who will take on Trump?

Choose your candidate and filter by category