Excerpts released from Hillary Clinton's upcoming book What Happened, looking at her failed 2016 presidential campaign, shows that the former secretary of State blames her defeat at least partly on her primary rival, Sen. Bernie Sanders.

In passages shared on social media, Clinton said that because she and Sanders agreed on most policy issues, the Vermont senator resorted to "innuendo and impugning my character."

"His attacks caused lasting damage, making it harder to unify progressives in the general election and paving the way for Trump's 'Crooked Hillary' campaign," wrote Clinton.

Clinton said she didn't "know if that bothered Bernie or not."

"He certainly shared my horror at the thought of Donald Trump becoming president," she said, adding that she was grateful for his support during the general election. But Sanders is an independent and "isn't a Democrat," Clinton said.

"He didn't get into the race to make sure a Democrat won the White House, he got in to disrupt the Democratic Party," she wrote.

Clinton said Sanders was right that Democrats needed to focus more on working-class families and less on wealthy campaign donors, but she said he was "fundamentally wrong about the Democratic Party."

Citing some of the party's successes Clinton said, "I am proud to be a Democrat and I wish Bernie were too."

Former president Barack Obama and Clinton's campaign team urged her not to hit back against Sanders out of concern that she would alienate his supporters, wrote Clinton.

"I felt like I was in a straitjacket," she said.

The 2016 Democratic nominee also accused Sanders' supporters of harassing her supporters online.

The attacks from the "Bernie Bros" got "ugly and more than a little sexist," Clinton said.

In the months since the election, Clinton has also blamed misogyny, former FBI director James Comey, Wikileaks and Russian interference for her 2016 defeat.

Read more:

The fall's hottest political books, from Hillary Clinton to Alec Baldwin

Hillary Clinton says 'skin crawled' when Trump stood behind her at debate

Hillary Clinton calling new book 'What Happened'

Hillary Clinton blames Comey, Wikileaks for 2016 election loss