A Greenpeace display scoring candidates seeking the Democratic presidential nomination on their climate change platforms is reflected in a window as attendees wait to see former vice president Joe Biden during a campaign event Tuesday in Ottumwa, Iowa. (Joshua Lott/Getty Images)

The lineup was set on Friday for back-to-back Democratic presidential debates later this month, after a lopsided drawing that placed most of the top candidates on a second night that is shaping up to be the marquee event.

The second night will feature former vice president Joe Biden and Sen. Bernie Sanders (I-Vt.), the two leading candidates in early polling, in what could be an epic clash over whether the future of the party rests in democratic socialism or bipartisan pragmatism.

Sen. Elizabeth Warren (D-Mass.), who has surged in recent state and national polls, is the biggest draw of the first night, which could work to her benefit by allowing her to stand out. But it also could lack the drama — and television ratings — of the second night. It could also provide other candidates that night, such as former congressman Beto O’Rourke (Tex.) or senators Cory Booker (N.J.) and Amy Klobuchar (Minn.), an opportunity to break through.

While the lineups were chosen through a randomized drawing — with candidates’ names written out on note cards and drawn to make two groups of 10 — four of the five top-polling candidates ended up clumped together. NBC News, which along with MSNBC and Telemundo will air the events, chose to hold that debate second as a way to increase ratings, which sparked protest from the Democratic National Committee and frustration from some of the presidential campaigns.

The debates, on June 26 and 27 in Miami, loom perhaps more important than ever this year, with a 23-candidate field so vast it has seemed to paralyze many primary voters and made it extraordinarily difficult for candidates to break out. This will be the largest audience that many candidates have ever appeared before, and all of them hope the debates offer a clarifying moment that works in their favor.

After six months of events in early states and elsewhere, the Democratic contest remains fluid and highly unpredictable. Candidates are starting to turn more of their time toward preparing for what will be the biggest single moment of the presidential race to date.

As the candidate leading in a broad range of polls, the debate will amount to a huge test for Biden, who at this point has largely avoided any multicandidate gatherings. Because of his debate draw, he will now share the stage with numerous strong candidates who have the shared goal of depleting his standing. For him, the debate creates a political briar patch of potential problems — but a strong performance could solidify his position.

Sanders has been among the most aggressive candidates in picking apart Biden’s record on topics like trade and the Iraq War, and his campaign has welcomed the back and forth. For him, the debate provides a high profile opportunity to contrast Biden’s relative incrementalism with Sanders’s Democratic socialist proposals, which have come under criticism from other candidates who say they provide a target for President Trump.

“This is a terrific lineup,” said Faiz Shakir, Sanders’s campaign manager.

The other candidates will be positioned to push the major thrusts of their campaigns, which also loom as potential vulnerabilities for Biden.

South Bend, Ind., Mayor Pete Buttigieg, at less than half the age of Biden and Sanders, will be able to make his generational argument just by standing there. Sen. Kamala D. Harris (D-Calif.), another in the race’s middle ranks, will have an opportunity to do what has eluded her so far — to join the top tier. She has criticized Biden’s crime bill at her events.

Sen. Kirsten Gillibrand (D-N.Y.), who has emphasized gender issues, would be poised to attack Biden’s touchy style and his past opposition on abortion rights matters. All will have a chance to contrast themselves with Sanders and Biden — particularly if the two septuagenarian white males are squabbling.

Also onstage for the second night will be Sen. Michael F. Bennet (Colo.), former Colorado governor John Hickenlooper, Rep. Eric Swalwell (Calif.), author and spiritual guru Marianne Williamson and technology entrepreneur Andrew Yang.

The group debating on the first night will include Warren, Booker, Klobuchar, and O’Rourke, as well as former Obama Cabinet member Julián Castro, New York Mayor Bill de Blasio, former congressman John Delaney (Md.), Rep. Tulsi Gabbard (Hawaii), Washington Gov. Jay Inslee, and Rep. Tim Ryan (Ohio).

Warren seems positioned to command attention on the debut debate night, but she will miss out on the action — and attention — that will come on the second. She will also have to make a strategic decision whether to sharply criticize the candidates not onstage whom she currently trails.

The first night features several candidates who have run on positivity — including O’Rourke and Booker — and if they maintain that approach it could lessen some of the ideological clashes that have come to define early parts of the primary contest.

For those positioned on the first night, even a breakout moment might have limited impact.

“There are two reasons why night two will be advantageous,” said an adviser to one of the campaigns, speaking on the condition of anonymity to converse freely. “There is definitely a benefit to seeing the night before, the rhythm of the thing. Also any of the [video] clips of night one will be quickly consumed by the preview of night two.”

The DNC had sought to divide the field in such a way that one debate would not appear more important than the other. The announcement Friday drew immediate questions about whether that goal had been met.

The candidates facing off in the second night of debates have a current combined polling of 66 percent, according to the RealClearPolitics average. The candidates in the first night combine for just 21 percent; only Warren is in double digits, with all other candidates that night holding less than 5 percent support.

How to stage debates with such a sprawling field has consumed the DNC over the past several months. The debate rules required candidates to score at least 1 percent in three party-approved public polls or receive contributions from 65,000 donors by Wednesday to qualify for the first set of debates.

On Thursday, the DNC announced that three major candidates failed to qualify: Montana Gov. Steve Bullock, Rep. Seth Moulton (Mass.) and Miramar, Fla., Mayor Wayne Messam.

Representatives from each of the other campaigns gathered Friday in an 11th floor conference room at NBC’s famed 30 Rockefeller Plaza headquarters, which had been laid out with a spread of sodas.

The NBC brass asked the campaigns to refrain from recording the session, though they had their own camera rolling. Although it wasn’t televised, campaign advisers in the room broadcast what was transpiring in real-time text messages and emails to their candidates and colleagues.

The cards with each candidate’s name were laid out on a table, then folded and placed into two gift-wrapped boxes, one for those polling at 2 percent or more and a second for those polling below. There would be two nights, code-named orange and purple, assigned in an alternating fashion.

Sanders was drawn first to purple, Booker to orange. Then Harris to purple, Warren to orange. Biden came next for purple, putting him on the same stage as Sanders and Harris.

“You could feel the oxygen go out of the room at that point, because it was very clear there would be an over-card debate,” said one person who attended the drawing and spoke on the condition of anonymity to describe the proceedings.

The DNC had intended the two nights to be randomly assigned, but before the drawing, an NBC representative had announced that after the orange and purple teams were picked, the network would decide which group went first.

A representative of the Booker campaign asked how the network would decide. To maximize viewership, came the response, and be fair to the candidates, according to two people who were there.

Xochitl Hinojosa, a representative of the DNC, voiced her objection to that decision, making clear to all the campaigns present that the party wanted the nights determined randomly. NBC did not change its mind.

Those lower-polling candidates chosen for the second debate were delighted. An adviser to Hickenlooper, who has tried to frame his campaign in opposition to Sanders-style socialism, said the campaign was happy he had landed on the same stage as Sanders and Biden.

“My dreams are coming true,” Yang, another purple denizen, wrote on Twitter.

The unveiling of the lineup prompted a flurry of tweets, email and fundraising appeals from the Democratic hopefuls, many of whom view the first debates as a welcome chance to distinguish themselves in the crowded field.

“I just got some big news,” Harris said in one fundraising appeal. “On June 27, 2019, I will share the national stage with candidates like Joe Biden, Bernie Sanders, and Pete Buttigieg for the first debate of this Democratic presidential primary in Miami, Florida.”

Delaney, who has struggled to gain traction in the polls despite extensive travel to early nominating states, wrote on Twitter that he is “pleased to be sharing the debate stage with many strong candidates, particularly Senator Warren who, like me, is talking about new ideas.”

“I look forward to a debate on issues and solutions, not personality and politics,” he added.

Bullock, meanwhile, released a digital ad questioning why the DNC had not permitted him to join the debates, citing his record of winning in a state that Trump carried by more than 20 percentage points over Democrat Hillary Clinton in 2016.

NBC News said the positioning of candidate lecterns onstage would be based on polling and will be announced at a later date.

Scott Clement contributed to this report.