DES MOINES — Conflict between Sens. Bernie Sanders (I-Vt.) and Elizabeth Warren (D-Mass.) is a story that has been waiting to happen. What no one expected is that their first clash of the 2020 Democratic president race would come over issues of gender, class and electability.

Everything you need to know about the debate: winners and losers and the Fact Checker’s rundown, plus a video showing you key moments. Sign up for the Trailer for campaign news and insight.

Contradictory versions of what happened during a private dinner more than a year ago as both were preparing to enter the race — Warren says Sanders told her a woman could not win the White House; Sanders says he said no such thing — brought them to the brink of open conflict. Significantly, the flash point underscored the broader reality that success for one could mean the undoing of the other.

When the two met on the debate stage Tuesday night, neither appeared eager to air the details of what happened at their dinner in December 2018. Sanders stoutly denied again that he said or believes that a woman can’t win the presidency. Warren stood by her version of events and used the moment to state forcefully why she is confident a woman can win and might do better than a man against President Trump.

But even if the two appeared ready to declare a truce about their dinner onstage, there is little doubt that they remain on a collision course as voters begin to cast their first votes of the campaign, with the Feb. 3 Iowa caucuses and the Feb. 11 New Hampshire primary the testing grounds that will shape the futures of both.

After the debate wrapped up, Warren appeared to avoid shaking hands with Sanders, and the two appeared to have a testy exchange.

Tuesday’s debate at Drake University was the last such event ahead of the caucuses, and it came days before the Senate begins the impeachment trial of the president. The debate highlighted that at a time when any of four candidates appear to have a chance of winning the caucuses, there are two pairings in competition with one another.

Former vice president Joe Biden and former South Bend, Ind., mayor Pete Buttigieg are appealing to those looking for more modest policy initiatives and calls for unity, with Sen. Amy Klobuchar (D-Minn.) trying to break into that competition. Meanwhile, Sanders and Warren are appealing to voters looking for big policy changes and a candidate with a fighting posture.

Neither Sanders nor Warren is thinking or talking about small-bore politics. Sanders wants a grass-roots revolution to overturn the current power structure. Warren has said, “We have a better chance of winning a big fight than we do a small fight.”

For the past year, the two have avoided taking on each other, preferring to focus on those larger visions. In part, that’s because they are longtime friends, having met years before Warren moved from academia to politics. They found common cause over the concerns about the hollowing out of the middle class and a shared belief that the economic and political systems are rigged against ordinary Americans.

They still share those assessments of the economy and of the political system. Sanders attacks the billionaire class at every turn. Warren describes the system as one that has been corrupted by money and power. Each has made that message the foundation of their presidential campaigns. And each is wary of alienating voters that are loyal to the other but at some point may be up for grabs.

For the past few months, Warren found herself looking at Buttigieg as a more immediate threat in Iowa. She took a lead in a September Iowa poll by the Des Moines Register and CNN, only to see Buttigieg overtake her in the November poll.

She and the mayor seemed to be competing in Iowa for the support of more-affluent voters with college degrees. Sanders’s campaign saw that as an opening and seized it. Over the weekend, Politico reported that volunteers in the Sanders campaign were being urged to tell voters that Warren was a candidate of the elite — of the rich and well educated.

Warren expressed disappointment, and Sanders noted that he had not personally approved the script used by the volunteers, emphasizing that he had not directly attacked Warren at any point since the campaign started. But that hardly resolved the matter. The Sanders campaign criticism appeared designed to cast Warren as a candidate with a narrower appeal.

Then came the story, first reported by CNN, about Sanders’s ostensible comments during the dinner conversation in December 2018. Whatever competition exists between Warren and Buttigieg — and there is some — the new story was a reminder of the inevitability of the competition between Sanders and Warren.

The biggest issue that has shadowed the candidacies of both Sanders and Warren is whether any nominee who is as liberal as they are, whose agendas would enlarge the role of government as much as each has proposed, can win a general election against Trump.

But the other question, heard from voters along the campaign trail, is whether any female candidate can capture the White House. It is a question understandably resented by female candidates, but one they nonetheless must confront. Warren did so cogently when the question arose in the debate.

“This question about whether or not a woman can be president has been raised, and it’s time for us to attack it head-on,” she said. “And I think the best way to talk about who can win is by looking at people’s winning record . . . Look at the men on this stage. Collectively, they have lost 10 elections. The only people on this stage who have won every single election that they’ve been in are the women, Amy and me.”

Warren also sought to harness her candidacy to earlier Democratic pathbreakers, noting that in 1960 some questioned if a Catholic could win the presidency and that in 2008 they asked the same about an African American — but that John F. Kennedy and Barack Obama proved them wrong.

Sanders said that “of course” a woman can win the presidency, but added that the central question for Democrats is who is best equipped to defeat Trump, and argued that the energy surrounding his candidacy gives him the strongest chance.

A major factor contributing to the inevitability of a Sanders-Warren clash is the political calendar, with the first two states — Iowa and New Hampshire — potentially decisive in determining which one has the support to move to the later contests with momentum.

Iowa has turned into a free-for-all. Sanders was leading in the latest Iowa poll, considered the most reliable indicator of voter attitudes here. Biden is leading in a Monmouth University poll released this week; Warren and Buttigieg both have led in earlier surveys. The order of finish in Iowa now becomes extremely important for all four candidates.

New Hampshire could be even more consequential, especially for Warren and Sanders, given political history. Both come from states adjacent to New Hampshire, which historically has proven an advantage.

That gives both of them a potential edge, and whoever finishes behind the other will have suffered a significant setback.

For the next three weeks, the fluidity of the competition in Iowa will consume all the campaigns. The major candidates will be looking at one another, aware that the order of finish, however close, will shape perceptions in ways that all the polls and commentary cannot do.

Sanders sees an opportunity to seize an advantage with a victory here and then in New Hampshire. Biden knows that a victory in Iowa could set him on a course to the nomination. Buttigieg knows that a strong finish here, especially one that puts him ahead of Biden, could be the springboard for his hopes. And Warren counts on her deep organization to surprise those who believe she has fallen back.

There have been surprises over the past year with the ebbs and flows of the polls and candidate performances. But there are some things about the Democratic race that have been clear from the start. One of those is the Warren-Sanders dynamic, and as the days before Iowa continue to dwindle, that has come into clearer focus.

Correction: An earlier version of this story misstated the year that John F. Kennedy was elected president. The story has been corrected.