Former Democratic National Committee Chairwoman Donna Brazile says President Obama decimated the party’s finances to win re-election in 2012 and that Hillary Clinton’s campaign took control of the DNC long before she defeated Sen. Bernard Sanders for the party’s presidential nomination last year.

In revelations from her upcoming book that are roiling an increasingly divided Democratic Party, Ms. Brazile said she was shocked at the sorry condition of the DNC’s finances when she took over in July 2016 for embattled Chairwoman Debbie Wasserman Schultz, who she said was “not a good manager.”

Ms. Brazile described a phone call she had with Gary Gensler, the chief financial officer of Mrs. Clinton’s campaign, on the morning after the Democratic National Convention ended in late July 2016.

“He told me the Democratic Party was broke and $2 million in debt,” Ms. Brazile wrote. “‘What?’ I screamed. ‘I am an officer of the party and they’ve been telling us everything is fine and they were raising money with no problems.’ That wasn’t true, he said.”

“Donna Brazile just stated the DNC RIGGED the system to illegally steal the Primary from Bernie Sanders. Bought and paid for by Crooked H,” the president tweeted. “This is real collusion and dishonesty. Major violation of Campaign Finance Laws and Money Laundering — where is our Justice Department?”

Also Thursday, the DNC dismissed its top fundraiser after five months on the job amid the party’s weak fundraising efforts. Finance director Emily Mellencamp Smith was let go in a shake-up.

The party had only $7 million on hand by the end of September. The DNC raised $51 million since January, but the Republican National Committee raised $104 million over the same period.

During eight years under Mr. Obama, Democrats lost more than 1,000 state and federal posts nationwide, including congressional and state legislative seats and governorships. Not as well-known was that Mr. Obama also left his party’s finances deep in the red.

“Officials from Hillary’s campaign had taken a look at the DNC’s books,” Ms. Brazile said. “Obama left the party $24 million in debt — $15 million in bank debt and more than $8 million owed to vendors after the 2012 campaign and had been paying that off very slowly.”

The manager of Al Gore’s presidential campaign in 2000 also described her shock at discovering a written agreement that proved what Mr. Sanders had been claiming — that the DNC was in the tank for Mrs. Clinton long before primary voting ended.

The joint fundraising agreement among the DNC, the Hillary Victory Fund and Hillary for America was signed by DNC official Amy Dacey and Clinton campaign manager Robby Mook.

The agreement “specified that in exchange for raising money and investing in the DNC, Hillary would control the party’s finances, strategy, and all the money raised,” Ms. Brazile said. “Her campaign had the right of refusal of who would be the party communications director, and it would make final decisions on all the other staff. The DNC also was required to consult with the campaign about all other staffing, budgeting, data, analytics, and mailings.”

The Clinton-DNC pact allowed donors who had maxed out their $2,700 individual contribution limit to write another check of up to $353,400 to Mrs. Clinton’s PAC. Of that, $10,000 would be given to the 32 state parties that were part of the agreement, for a total of $320,000.

“The funding arrangement with HFA and the victory fund agreement was not illegal, but it sure looked unethical,” Ms. Brazile wrote. “If the fight had been fair, one campaign would not have control of the party before the voters had decided which one they wanted to lead. This was not a criminal act, but as I saw it, it compromised the party’s integrity.”

The agreement was signed in August 2015, just four months after Mrs. Clinton announced her candidacy and almost a year before she secured the party’s nomination.

Ms. Brazile said, “I had been wondering why it was that I couldn’t write a press release without passing it by Brooklyn [site of Clinton campaign headquarters]. Well, here was the answer.”

The result was the Clinton campaign controlled the vast bulk of the party money and doled out small shares to the DNC to keep it afloat. Mr. Gensler told Ms. Brazile that the Clinton campaign “had to do it or the party would collapse.”

Ms. Brazile’s revelations produced a chorus of I-told-you-so’s from the Democratic Party’s grass roots and raised calls to end what many consider a “rigged game” of superdelegates controlled by the party establishment.

Nina Turner, president of Our Revolution, the outside group started by Mr. Sanders after the 2016 campaign, said Ms. Brazile “just told the world what millions of independents and progressives already suspected.”

“The presidential primary was rigged as far back as 2015, as then-chair Debbie Wasserman Schultz ceded all authority to the Clinton campaign,” she said in a fundraising email. “The DNC’s reliance on big money donors tipped the scales against progressives.”

Mrs. Turner said the DNC leadership “continues to alienate progressives.”

“Tom Perez, the current DNC Chair, just demoted supporters of Senator Bernie Sanders and Representative Keith Ellison, including Our Revolution Board Member Dr. Jim Zogby, the only Arab American, from the Executive Committee,” Mrs. Turner said. “The DNC’s preference for large campaign contributions over our revolutionary model of small-dollar donations goes against everything a grassroots organization is supposed to be about. Progressives, independents, and a growing number of Democrats feel that the party no longer works for them. That has to change.”

Republican National Committee Chairwoman Ronna Romney McDaniel said Mr. Sanders has every right to be upset about the Democratic primary race.

“To see that the Hillary Clinton campaign was funding the DNC and in return demanded total control of the DNC before she was the nominee shows how truly broken the DNC was,” Mrs. McDaniel said on Fox News. “Donna Brazile has shed light on the total dysfunction of the DNC and how clearly they put their thumb on the scale for Hillary Clinton.”

Adam Green, co-founder of the Progressive Change Campaign Committee, said the developments add urgency to the pending recommendations of the party’s Unity Reform Commission, which was created at the national convention as a last-minute compromise with Sanders supporters who were demanding the elimination of superdelegates from presidential primaries.

“When it comes to fostering trust in the DNC, the entire ballgame is the Unity Reform Commission’s forthcoming proposals and whether they are strong and adopted by DNC leadership,” Mr. Green said. “Those proposals should include dramatically scaling back the role of unelected superdelegates in skewing the nomination process, making primaries open to more people, making caucuses less time-consuming for working families, and mandating more DNC budget transparency and oversight.”

He said in light of Ms. Brazile’s revelations, “reforms should also include barring joint fundraising agreements that give an advantage to one candidate over another during a primary.”