Debbie Wasserman Schultz, the chairwoman of the Democratic National Committee said she will resign this week in the aftermath of the release of thousands of internal email exchanges among Democratic officials. (Thomas Johnson,Monica Akhtar/The Washington Post)

The Democratic National Committee chairwoman resigned under fire Sunday, on the eve of a national convention meant to project competence and unity in contrast to the turbulence of the Republicans’ gathering last week.

The disarray threatened to upend Hillary Clinton’s plan to paint the Democrats as the party best prepared to lead a divided and anxious country and herself as the leader who can offer an optimistic alternative to Republican Donald Trump.

Debbie Wasserman Schultz of Florida was forced aside by the release of thousands of embarrassing emails among party officials that appeared to show co­ordinated efforts to help Clinton at the expense of her rivals in the Democratic primaries. That contradicted claims by the party and the Clinton campaign that the process was open and fair for her leading challenger, Sen. Bernie Sanders of Vermont.

The trove of messages released by hackers on the website WikiLeaks proved to be the last straw for Democrats, including top Clinton advisers.

The Post's Ellen Nakashima goes over the events, and discusses the two hacker groups responsible. (Jhaan Elker/The Washington Post)

“Myself and other Democrats who were Clinton supporters, we have been saying this was serious. It truly violates what the DNC’s proper role should be,” said Edward G. Rendell, a former DNC chairman and former Pennsylvania governor.

“The DNC did something incredibly inappropriate here” and needed to acknowledge that, Rendell said.

Republicans, led by Trump, jumped to portray the episode as evidence that the system was rigged for Clinton, whom Trump calls “Crooked Hillary.”

“The Democrats are in a total meltdown but the biased media will say how great they are doing!” Trump said on Twitter. ­“E-mails say the rigged system is alive & well!”

Republican National Committee Chairman Reince Priebus, who is Wasserman Schultz’s counterpart, told reporters, “There was no way out. The end has come. There wasn’t any other outcome that was foreseeable.”

Sanders said he was not surprised by the email revelations. He is scheduled to address Monday’s opening night of the Democratic convention. While he is expected to stress unity, many of his supporters say they are furious about what they see as evidence of party bias.

The Clinton campaign — and several cybersecurity experts — said the leak was a political ploy carried out by the Russian government to aid in the election of Trump.

That didn’t stop a massive political firestorm directed largely at Wasserman Schultz — nor strong pressure from the Clinton campaign and others for the chairwoman to step aside, according to a senior Democrat familiar with the negotiations.

She finally did, but not before speaking with President Obama — and not without a fight, according to Democrats familiar with the negotiations.

Wasserman Schultz, a member of Congress from South Florida, said in a statement that her resignation will take effect upon the close of the convention. Donna Brazile, a longtime Democratic strategist, will take over as interim chair, according to the DNC.

“I know that electing Hillary Clinton as our next president is critical for America’s future,” Wasserman Schultz said in a statement. “I look forward to serving as a surrogate for her campaign in Florida and across the country to ensure her victory.”

The controversy blew up at a key political moment for Clinton, just as convention delegates were descending on Philadelphia — and just as her campaign was hoping to patch up disagreements with Sanders supporters over superdelegates, the party platform and her choice of her running mate, Sen. Timothy M. Kaine of Virginia, who is seen by some as insufficiently progressive.

Erin Bilbray, a DNC member from Nevada who supported Sanders in the primaries, said there had been talk about some delegates turning their backs on Wasserman Schultz in a show of protest during the convention if she didn’t step down.

“There definitely would have been some anger in the convention hall,” Bilbray said. “Hopefully, this will be a good thing for unity in Philadelphia.”

In pressuring Wasserman Schultz to resign, campaign officials argued that she had become a lightning rod for divisions within the party.

Democrats said pressure was applied, both publicly and behind the scenes, in hopes of getting the embarrassing episode over as quickly as possible. Democrats began lobbying Clinton campaign chairman John Podesta on Saturday, arguing that the campaign had to step in before the damage worsened.

And the chairwoman’s resignation may not be the end of it. R.T. Rybak, a former Minneapolis mayor and a DNC vice chairman, said in an interview that Wasserman Schultz did the right thing by resigning and “allowing the rest of us to clean up this mess so that we can quickly pivot to talking about Hillary Clinton.”

Rybak called for DNC staff members who wrote emails aiming to discredit Sanders or any other candidate to be dismissed.

“There is some deeply disturbing information in the emails, but they don’t need to distract from the convention if the DNC takes clear and immediate action,” Rybak said. “We should clearly state that any person from the DNC who worked to discredit another presidential candidate, especially on DNC time and equipment, should be fired immediately. No question.”

According to one Democratic member of Congress involved in the discussions leading up to her resignation, Wasserman Schultz strongly resisted giving up her position amid discussions that staff members should shoulder some of the blame. Among the options discussed was having Amy Dacey, the DNC’s chief executive officer, put out a statement, according to two Democratic sources.

That served to exacerbate other Democrats’ frustration with Wasserman Schultz — and led to accusations that she had made the situation worse by not acting swiftly to step aside as the convention loomed.

“There was a lot of drama,” this lawmaker said, speaking on the condition of anonymity because of the sensitivity of the matter. “She made this as painful as she could. She did not want to go. . . . She wasn’t going to resign until the president called her. She put a lot of people through hell.

“We were going to come into the week and be united,” said the member of Congress. “But she did ugly and messy and stepped on the message of unity.”

This person said that senior Democrats expect there to be additional departures from the DNC’s senior staff in coming days.

Brazile is taking over as the interim chair, but discussions were underway Sunday about who might be suitable to step in as chair between now and the November election. Among the Democrats mentioned: former Michigan governor Jennifer Granholm, Rep. Steve Israel of New York and EMILY’s List President Stephanie Schriock. All are loyal supporters and trusted allies of Clinton.

Less clear is how much turmoil remains within the party, even with Wasserman Schultz gone. According to one top Democratic official who requested anonymity to speak candidly, “People feel the culture of the DNC is not right, and it starts at the top.”

In addition to the friction with Sanders and his supporters that was revealed in the email hack, donors were upset about the way they were talked about in some of the emails.

In one email exchange in May, national Finance Director Jordan Kaplan and one of his deputies, Alexandra Shapiro, strategized about where to seat a major Florida donor, Stephen Bittel, at a DNC fundraiser featuring Obama. Bittel, a real estate mogul in South Florida, appears to have exasperated the officials, the documents suggest.

“He doesn’t sit next to POTUS!” Kaplan wrote.

“Bittel will be sitting in the sh---iest corner I can find,” responded Shapiro, who also referred to donors who had yet to confirm for the event as “clowns.”

Wasserman Schultz expects to continue to help out through the end of the convention.

In addition, Clinton issued a statement in which she announced that Wasserman Schultz would serve as honorary chair of the campaign’s 50-state program as well as continuing as a surrogate nationally and in Florida.

In a statement, Obama said he was “grateful” for Wasserman Schultz’s service. “Her fundraising and organizing skills were matched only by her passion, her commitment and her warmth,” the president said. “And no one works harder for her constituents in Congress than Debbie Wasserman Schultz.”

Others were less generous.

“On the whole, I’d rather she not be in Philadelphia,” said James Carville, a longtime Clinton confidant.

Clinton’s campaign manager, Robby Mook, said that the DNC would need to investigate the hack, including checking to see whether any emails were “doctored,” and that the party would “take appropriate action.”

“What’s disturbing to us is that experts are telling us that Russian state hackers broke into the DNC, stole these emails, and other experts are now saying the Russians are releasing these emails for the purpose of actually helping Donald Trump,” Mook said on CNN’s “State of the Union.” “I don’t think it’s coincidental that these emails were released on the eve of our convention here, and that’s disturbing.”

Trump’s campaign chairman, Paul Manafort, said Mook’s Russia theory is “absurd.” Asked about Mook’s allegation that the Russians were trying to help Trump by releasing damaging DNC emails, Manafort said, “It’s a far reach, obviously.”

The Washington Post reported last month that Russian government hackers penetrated the DNC, stealing opposition research about Donald Trump and compromising the party’s email and chat systems.

But that explanation seems unlikely to mollify Sanders supporters who are angry about the messages and distrustful of Clinton and the party.

The emails revealed a DNC official apparently discussing how to use Sanders’s religion against him to help Clinton ahead of the Kentucky and West Virginia primaries. In another email, a Clinton campaign lawyer suggested to the DNC how it should respond to claims from the Sanders campaign that it was improperly using a joint fundraising committee with state parties.

The messages also reveal the prized perks given to the party’s top donors.

Central themes of the Democrats’ convention will be optimism and inclusion, in direct contrast to what Clinton calls Trump’s divisive and dysfunctional politics. Democrats have planned to use the spectacle of the Republican convention as Exhibit A for how not to lead.

DNC spokesman, Luis Miranda, who announced Brazile as the interim party leader in a Twitter message Sunday, had earlier recapped the Republican convention by saying “it was a chaotic week that set a low bar.”

Monday’s convention program is expected to open with some of the party’s biggest political stars, and it will highlight some of the party’s most progressive voices.

Sanders, first lady Michelle Obama and Warren, the senator from Massachusetts and a liberal firebrand, are expected to kick off the opening session.

Sanders moved quickly Sunday to separate the dispute with the DNC from his support for Clinton. He strongly denied that the revelations had changed his support for her and said the real threat was Trump.

“To my mind, what is most important now is the defeating of the worst candidate for president that I have seen in my lifetime, Donald Trump, who is not qualified to be president by temperament, not qualified to be president by the ideas that he has brought forth,” Sanders said on ABC.

Brazile, a vice chair of the convention, also was caught up in the leak. Asked for comment in an email from a Washington Post reporter about negotiations between the Sanders campaign and the DNC about the composition of the party’s convention committees, Brazile forwarded the reporter’s request to DNC officials.

“I have no intentions of touching this,” she said. “Why? Because I will cuss out the Sanders camp!”

Phillip reported from Washington. Dan Balz, Lois Romano and David Weigel in Philadelphia, Karen Tumulty in Washington and John Wagner in Raleigh, N.C., contributed to this report.