Andrew Harnik / AP

Former Labor Secretary Thomas Perez—the candidate backed by the Democratic Party’s establishment—was elected chairman of the Democratic National Committee on Sunday, as its members chose a close ally of both Barack Obama and Hillary Clinton to lead the out-of-power party in the era of Donald Trump.

Perez defeated Representative Keith Ellison of Minnesota, the favorite of many progressives, and a collection of lesser-known candidates in a vote of the 435 committee members who participated in the balloting in Atlanta. Perez won on the second ballot after coming a single vote shy of capturing the simple majority needed in the first round of balloting. The final two-way vote was 235-200. In a bid to head off a revolt from Ellison backers, Perez immediately moved to name his rival as deputy chairman, which the party members ratified by acclamation.

As DNC chairman, Perez will be responsible for rebuilding a party that has been decimated in recent years. Democrats lost control of Congress, dozens of governorships, and hundreds of state legislative seats in the last eight years—a period that culminated last November in the most stinging defeat of all: Clinton’s loss to Trump.

To the dismay of many rank-and-file Democrats, the race for DNC chairman became something of a proxy fight that mirrored the presidential primary battle between Clinton and Senator Bernie Sanders of Vermont. Perez won the support of Clinton and Obama confidantes, while Sanders and progressive groups rallied around Ellison, a staunch liberal who predicted early on that Trump would take hold of the Republican Party. And in a battle to lead the party’s central fundraising and recruitment organization, it was not a big surprise that the establishment’s favored candidate won. Both candidates appealed to committee members to unify behind the winner—a nod to the lingering bitterness among the most fervent Sanders and Ellison backers stemming from the 2016 primary process.

The 35-year-old mayor of South Bend, Indiana, Pete Buttigieg, made a strong impression on Democrats as an up-and-coming outsider who stressed his ties to the white working class voters who have abandoned the party. But despite a late endorsement from former DNC chairman and presidential hopeful Howard Dean, Buttigieg’s bid to emerge as a consensus choice in the event of a Perez-Ellison deadlock fell short. He dropped out minutes before the vote.

There were few policy differences among the candidates, who hewed closely to the progressive platform Clinton blessed to win over Sanders supporters last year. Perez drew criticism for his support, as a member of Obama’s Cabinet, of the Trans Pacific Partnership, which Ellison strongly opposed. And as Democrats across the country have become enraged at the early moves by the Trump White House, each of the candidates adopted a posture of all-out opposition to the new president. At a candidate debate on CNN last week, Ellison said Trump had already “done a number of things that raise the question of impeachment.”

The DNC chairmanship is a political position, not a policymaking one. With Democrats out of the White House, the chairman becomes a key spokesman for the party on television, but the job is fundamentally about fundraising, candidate recruitment, and building up a party apparatus than can win races at the local, state, and national level.

Perez, a former assistant attorney general for civil rights in the Justice Department, pitched himself as a turnaround artist who would change the culture at the DNC. “We are suffering from a crisis of confidence, a crisis of relevance,” he told committee members before the vote.

Ellison’s supporters championed him as someone who could harness the passion of Democratic activists protesting throughout the nation and in particular, ensure that the party reversed its turnout struggle in off-year elections. “We are in this mess because we lost not just one election but 1,000 elections,” Ellison said in his nominating speech.

The Ellison-Perez battle did not break down completely along the 2016 Clinton-Sanders divide. Ellison won a key early endorsement from Charles Schumer of New York, the new Senate minority leader who has tried to build up a rapport with the party’s left-wing. As the nation’s most powerful Jewish politician, Schumer’s support helped allay concerns about Ellison’s past criticism of Israel and his association with the Nation of Islam. The Minnesota lawmaker stressed his support for Israel and in the final days of the race denounced Trump for omitting references to Jews in a statement on the Holocaust and for his lackluster condemnation of threats against Jewish community centers across the country. Ellison also vowed to resign from Congress if he won to devote his full energy to leading the DNC.

But his initial momentum was not enough to keep Perez from entering the race at the urging of former Clinton and Obama aides. While the former president stayed neutral, former Vice President Joseph Biden threw his support to Perez. He sealed his victory in the final days after another Jaime Harrison, chairman of the South Carolina Democratic Party, withdrew from the race and endorsed Perez.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.