Demos Parneros was fired last month as Barnes & Noble’s chief executive. Mr. Parneros filed a lawsuit Tuesday claiming defamation and breach of contract.CreditCreditJoshua Bright for The New York Times

When Barnes & Noble fired its chief executive, Demos Parneros last month, the bookseller was mysteriously quiet about why.

On Tuesday, the explanation came spilling out in a public exchange of accusations between Mr. Parneros and the company — including that Mr. Parneros had been fired in part because of claims of sexual harassment by an employee.

The fight began when Mr. Parneros filed a lawsuit claiming defamation and breach of contract. He said that he had been fired without warning after a deal to sell the company fell through. Casting himself as a “well-respected retail executive,” he claimed that the bookseller had enabled rumors that he was let go because of “serious sexual misconduct.”

He described Barnes & Noble as a “financially troubled business” that is in turmoil and disarray, with a “volatile” chairman who “refuses to relinquish control.” He said he was owed severance of $4 million in cash, plus equity and damages.

In response, Barnes & Noble’s board said in a statement that Mr. Parneros had been “terminated for sexual harassment, bullying behavior and other violations of company policies.” Until Tuesday, the company had said only that he was terminated for violating policies, without further explanation except to say they were not related to financial matters.

In his lawsuit, Mr. Parneros referenced the alleged misconduct, revealing details that Barnes & Noble had not disclosed.

He played down his interactions with an executive assistant who had made an internal complaint against him as “simply an innocuous, less than five-minute conversation about vacationing in Quebec.” Another impetus for his firing, he said, was his purported mistreatment of Allen W. Lindstrom, the company’s chief financial officer.

Mr. Lindstrom is one of three executives sharing chief executive duties until Mr. Parneros’ successor is found.

In the filing, Mr. Parneros saved his harshest condemnation for Leonard Riggio, Barnes & Noble’s chairman and largest shareholder, citing his “erratic and unprofessional behavior.”

Barnes & Noble said in its statement that the allegations about Mr. Riggio “are replete with lies and mischaracterizations” and an example of Mr. Parneros being “someone who, instead of accepting responsibility for blatantly inappropriate behavior, is lashing out against a former employer.”

In the spring of 2017, Mr. Riggio brought Mr. Parneros on as the company’s leader, the fourth non-interim chief executive in four years, to try to bolster the bookseller’s flagging fortunes, according to the lawsuit. Mr. Parneros had worked for nearly three decades in various roles at the office supply chain Staples.

Mr. Riggio, who bought the company in 1971 when it was an ailing Manhattan bookstore and turned it into a national fleet of superstores, had planned to retire in 2016. But he stepped in as acting chief executive after Barnes & Noble fired Ronald Boire, who had served as chief executive for less than a year.

Publishers and investors have grown increasingly worried about the company’s future. Some industry analysts argue that Mr. Riggio has been too heavy-handed in steering the company and lacks the vision to guide its recovery at a tumultuous moment.

In his lawsuit, Mr. Parneros said that Mr. Riggio had said that “he had to run the company and could not be a spectator.”

The allegations lobbed in the suit are likely to make it even more difficult for Barnes & Noble to recruit its next chief executive, at a moment when the company desperately needs stable leadership.

[Read more about Mr. Riggio’s role at Barnes & Noble and how he responded to criticism in an interview with The New York Times.]

Barnes & Noble’s stock price has fallen 60 percent over the last three years, and the chain has struggled to reverse years of declining sales and foot traffic. In the last decade, the company has closed more than 150 stores, leaving it with a base of 633. It waged a losing battle with Amazon, losing more than a billion dollars on its Nook e-book business.

Even as independent bookstores have bounced back and Amazon has expanded into brick-and-mortar retail, Barnes & Noble has still failed to recover ground.

But Mr. Parneros said that he was lavished with praise by Mr. Riggio, the Barnes & Noble board, investors and publishers as he helped fill empty executive roles and introduce new store prototypes and sales categories.

In November, the activist investor Sandell Asset Management offered to buy the chain, an overture that Barnes & Noble refused. In the spring, a book retailer made a bid, which Barnes & Noble also declined, according to Mr. Parneros.

In June, after conducting due diligence, the book retailer withdrew its purchase offer, leaving Mr. Riggio “extremely upset” because he “no longer had a graceful exit from the company,” according to Mr. Parneros’ lawsuit.

At that point, Mr. Riggio “turned against” Mr. Parneros, stopped returning his calls and texts and fabricated reasons to remove him, according to the lawsuit. On July 2, Mr. Parneros was dismissed, without the millions of dollars in severance payments that his predecessors had received, he said.

In a news release in July announcing his departure, Barnes & Noble said that Mr. Parneros had violated company policy, a move that he said the company knew would lead to speculation that he had engaged in sexual misconduct.

Mr. Parneros said in his complaint that he had “always conducted himself in a professional manner” and that his reputation has been damaged. He was forced to resign from the board of KeyBank after more than four years as a member, and references to an honorary degree bestowed upon him by a Massachusetts college were removed from its website, he said.

Barnes & Noble said in its statement on Tuesday that the board unanimously agreed to fire Mr. Parneros following an investigation that revealed “multiple examples of significant misconduct.”

In his lawsuit, Mr. Parneros said he was called into Mr. Riggio’s office weeks before his firing and told about complaints from an executive assistant.

According to the lawsuit, the assistant had said that, during a conversation about her vacation to Canada, Mr. Parneros had characterized a hotel he had visited with his wife as the kind of place where “you would put out.” Mr. Parneros said he disputed the claim, saying that he had described the hotel as charming and romantic.

He also countered a complaint from the assistant that, during a conversation about which person was taller, he had stood back to back with her. He said that they had only stood side to side, with no inappropriate touching.

Mr. Riggio had indicated that he did not consider the incidents to be too serious, according to the lawsuit. But Mr. Parneros said he wanted to apologize, and brought a company representative with him to meet with the assistant.

According to the suit, all parties, including Mr. Riggio, agreed that the meeting went well, and the assistant said that she did not want to make a big deal out of the situation and did not want to transfer to a different position.

Mr. Parneros also said that he had treated Mr. Lindstrom, the chief financial officer, “appropriately” given what he described as Mr. Lindstrom’s poor performance. Mr. Lindstrom did not respond to a request for comment.

According to Mr. Parneros’s lawsuit, Mr. Riggio was disparaging toward Mr. Lindstrom, and created an “abusive corporate culture” that involved personal attacks focused on the mental health, appearance and other attributes of several employees.

In its statement, Barnes & Noble said that Mr. Riggio is widely known” for his “impeccable reputation and as an individual and leader that upholds the highest standards of integrity and decency.”