DES MOINES, Iowa — Elizabeth Warren made a vigorous case for a female president and stood behind her accusation suggesting sexism by progressive rival Bernie Sanders in a tense Democratic debate Tuesday night that raised gender as a key issue in the sprint to Iowa’s presidential caucuses.

Sanders vehemently denied Warren’s accusation, which threatened to split the Democratic Party’s far-left flank — and a longtime liberal alliance — at a critical moment in the 2020 contest.

“Look at the men on this stage. Collectively they have lost 10 elections,” Warren exclaimed. “The only people on this stage who have won every single election that they’ve been in are the women.”

An incredulous Sanders responded: “Does anybody in their right mind think a woman can’t be elected president?” he asked. “Of course a woman can win.”

He added: “I don’t know that that’s the major issue of the day.”

The drama unfolded just 20 days before Iowa’s kickoff caucuses with four candidates tangled at the top of the shifting field.

Longtime allies Warren and Sanders are icons in the party’s left wing. Former Vice President Joe Biden, considered the centrist in the race, has maintained his place as an establishment favorite thanks to relationships with Democratic officials that have spanned decades. And Pete Buttigieg, a virtual unknown a year ago, is trying to carve his own path as a 37-year-old openly gay military veteran from the Midwest.

Minnesota Sen. Amy Klobuchar and businessman Tom Steyer joined them on stage.

The race until now has been defined by respectful policy differences and urgent opposition to President Donald Trump’s reelection. But Tuesday night, the simmering feud between Warren and Sanders — literally a “he-said, she-said” clash between the progressive movement’s two biggest stars — sometimes overshadowed criticism of Trump and the left wing’s desire to attack Biden and Buttigieg.

Trump, campaigning in neighboring Wisconsin just as Democrats took the debate stage, tried to encourage the feud between Sanders and Warren from afar.

“She said that Bernie stated strongly that a woman can’t win. I don’t believe that Bernie said that, I really don’t. It’s not the kind of thing Bernie would say,” Trump said.

Just six candidates gathered in Des Moines, each eager to seize a dose of final-days momentum on national television before Iowa’s February 3 caucuses. Diversity was a focus even before the prime-time event began.

For the first time, not a single candidate of color appeared on stage. All six candidates who met the party’s polling and donor thresholds were white, and four were men.

The Democratic field’s eroding diversity comes as the party tries to navigate broader debates over how to reflect and embrace the crucial role women and minority voters will play in 2020. To defeat Trump this fall, Democrats need to ensure black, Latino, and suburban voters are excited to vote against the Republican president.

Tuesday’s debate showcased differences between the candidates on a number of issues.

Sanders stepped up his attacks on Biden over the former vice president’s past support of the Iraq War and broad free-trade agreements. Klobuchar, who has had several strong debates, looked for opportunities as she remained mired in the middle of the pack in polling.

Billionaire Steyer faced criticism that he’s trying to buy his way to the White House.

With surveys showing Buttigieg losing support in Iowa, the mayor of South Bend, Indiana, struggled for attention in a debate that often featured points of conflict among his rivals.

The evening began with the candidates clashing over Iraq, war, and foreign policy, although they were largely united against Trump’s leadership on such issues.

Sanders drew a sharp contrast with Biden by noting that Sanders aggressively fought against a 2002 measure to authorize military action against Iraq.

Sanders called the Iraq invasion “the worst foreign policy blunder in the modern history of this country.”

“I did everything I could to prevent that war,” Sanders said. “Joe saw it differently.”

Biden acknowledged that his 2002 vote to authorize military action was “a mistake” but highlighted his role in the Obama administration helping to draw down the U.S. military presence in the region.

Several candidates condemned Trump’s recent move to kill Iran’s top general and his decision to keep U.S. troops in the region.

“We have to get combat troops out,” declared Warren, who also called for reducing the military budget.

Others, including Buttigieg, Biden and Klobuchar, said they favored maintaining a small military presence in the Middle East.

“I bring a different perspective,” said Buttigeg, who was a military intelligence officer in Afghanistan. “We can continue to remain engaged without having an endless commitment to ground troops.”

The candidates will not share a debate stage again until after Iowa’s February 3 caucuses, which will offer the first dose of clarity to the Democrats’ yearlong nomination fight.

Until then, the campaigning that played out Tuesday will take place in the living rooms and community centers of Iowa and the other early voting states. Meanwhile, Trump, with no serious primary election of his own to speak of, is free to continue focusing his political machine on the general election.

Peoples and Superville reported from Washington. Associated Press writers Bill Barrow in Des Moines contributed to this report.