Donna Brazile, former interim chair of the Democratic National Committee, said Hillary Clinton gained control of the political party before she won the presidential nomination in an effort to squeeze out Bernie Sanders.

She began investigating whether Clinton “rigged the nomination process” as emails hacked from the DNC and published by WikiLeaks last year had suggested, she said in an except of her new book coming out next week that appeared Thursday in Politico.

Brazile said she eventually discovered that Clinton had entered into a secret agreement with the Hillary Victory Fund, Hillary for America and the cash-strapped DNC that in exchange for raising funds, Clinton “​would control the party’s finances, strategy, and all the money raised.”

The deal also gave her campaign “right of refusal” over who would be the party’s communications director and final say on all other staff.

​”The DNC also was required to consult with the campaign about all other staffing, budgeting, data, analytics, and mailings,” Brazile said.​

“I had been wondering why it was that I couldn’t write a press release without passing it by Brooklyn. Well, here was the answer,” she said, referring to Clinton’s campaign headquarters in the borough.

With the proof in hand, Brazile said, she had to talk to Sanders.

​”I told Bernie I had found Hillary’s Joint Fundraising Agreement. I explained that the cancer was that she had exerted this control of the party long before she became its nominee,” she said about the September 2016 phone call. “Had I known this, I never would have accepted the interim chair position, but here we were with only weeks before the election.”

She said the independent from Vermont took the news “stoically.”

“When I hung up the call to Bernie, I started to cry, not out of guilt, but out of anger. We would go forward. We had to,” she said.

Brazile had taken over running the DNC in July after Debbie Wasserman Schultz had been ousted as chairwoman when the leaked emails showed party officials were conspiring to defeat Sanders.

In October 2016, Sanders’ supporters launched a petition to force Brazile to step down from the DNC after emails revealed she gave the Clinton campaign advance questions for a town hall event between Clinton and Sanders.

Brazile’s book, “The Inside Story of the Break-ins and Breakdowns that Put Donald Trump in the White House,” will be published Nov. 7.

Clinton spokesman Nick Merrill tweeted sarcastically, “If you want to be a conspiracy theorist, lets note that HRC campaign conspired to fund the caucuses, majority of which we lost.”

Wasserman-Schultz had no immediate comment.