Hillary Clinton admitted in her new book that it "was a mistake" for her to rake in six-figure fees for corporate speeches on Wall Street just before running for president, which both Republicans and Democrats criticized during the campaign.

"I should have realized it would be bad ‘optics' and stayed away from anything having to do with Wall Street. I didn't. That's on me," she wrote in her book that was released Tuesday, "What Happened."

At the same time, Clinton defended her decision to accept the "pretty penny" she received from companies, and said it was something many former officials do.

"[L]ike many former government officials, I found that organizations and companies wanted me to come talk to them about my experiences and share my thoughts on the world — and they'd pay me a pretty penny to do it," Clinton wrote.

"I continued giving many speeches without pay, but I liked that there was a way for me to earn a very good living without working for any one company or sitting on any board," she added.

Clinton was criticized in 2016 for not releasing transcripts of the speeches she gave to Wall Street banks, although excerpts of those remarks eventually leaked and damaged her campaign.

"What I had to say was interesting to my audiences, but it wasn't especially newsworthy," Clinton wrote. "Many of the organizations wanted the speeches to be private, and I respected that: they were paying for a unique experience."

The former Democratic presidential nominee claimed her opponents "spun wild tales about what terrible things I must have said behind closed doors."

Some of Clinton's speeches did prove toxic to her campaign when they went public after WikiLeaks published a trove of emails stolen from her campaign chairman, John Podesta.

For example, in one private speech, Clinton argued in favor of "open trade and open borders," a position that stood in direct contradiction of her stated opposition to free trade deals like the Trans-Pacific Partnership.