In March 2017, Eliza Dushku, an actress known for her work on “Buffy the Vampire Slayer,” signed on to play a major role in three episodes of the CBS prime-time drama “Bull,” and there were plans to make her a full-time cast member.

Her time on the set began promisingly. The show’s star, Michael Weatherly — a mainstay of CBS’s prime-time lineup for 15 years — seemed friendly. And a producer and writer on “Bull,” Glenn Gordon Caron, told Ms. Dushku she would be more than a love interest.

Then came a series of comments that made Ms. Dushku uncomfortable. In front of the cast and crew, Mr. Weatherly remarked on her appearance, and made a rape joke and a comment about a threesome. Shortly after Ms. Dushku confronted the star about his behavior, she was written off the show. She believed her time on “Bull” came to a sudden end as a result of retaliation.

After she went through mediation with CBS, the company agreed to a confidential settlement that would pay her $9.5 million, roughly the equivalent of what Ms. Dushku would have earned if she had stayed on as a cast member for four seasons.

[See the timeline of CBS misconduct allegations and attempts to cover them up.]

Details of Ms. Dushku’s experiences on “Bull” and the confidential settlement she reached with the company emerged during the course of an investigation that began in August, when the CBS Corporation board hired the law firms Covington & Burling and Debevoise & Plimpton to examine accusations of sexual misconduct made by multiple women against Leslie Moonves, the company’s former chief executive. The board also instructed the outside lawyers to investigate “cultural issues at all levels of CBS.”

In a draft of the investigation report, which was reviewed by The New York Times, the lawyers said the company’s handling of Ms. Dushku’s complaints was not only misguided, but emblematic of larger problems at CBS. When faced with instances of wrongdoing, the company had a tendency to protect itself, at the expense of victims, the investigators wrote.

[Leslie Moonves, the former CBS chief executive, obstructed an investigation into misconduct claims against him, a report says]

Ms. Dushku declined to comment for this article. In a statement on Wednesday, CBS confirmed the settlement and pledged to improve working conditions.

“The allegations in Ms. Dushku’s claims are an example that, while we remain committed to a culture defined by a safe, inclusive and respectful workplace, our work is far from done,” the statement said. “The settlement of these claims reflects the projected amount that Ms. Dushku would have received for the balance of her contract as a series regular, and was determined in a mutually agreed upon mediation process at the time.”

In an emailed statement to The Times, Mr. Weatherly apologized for his behavior with Ms. Dushku.

“During the course of taping our show, I made some jokes mocking some lines in the script,” Mr. Weatherly said in the statement. “When Eliza told me that she wasn’t comfortable with my language and attempt at humor, I was mortified to have offended her and immediately apologized. After reflecting on this further, I better understand that what I said was both not funny and not appropriate and I am sorry and regret the pain this caused Eliza.”

“Bull,” an hourlong procedural series that premiered in September 2016, is the 10th most-watched entertainment program on network television. The main character is loosely based on Dr. Phil McGraw, who worked as a trial consultant before he became a popular talk-show host.

Dr. McGraw is one of the producers of “Bull,” as is Mr. Caron, who created the prime-time hit “Moonlighting.” Shot mainly in New York, “Bull” is produced in association with Steven Spielberg’s Amblin Television.

Mr. Weatherly, 50, was a star of the network’s most popular drama, “NCIS,” for 13 seasons before CBS gave him “Bull.” The character he plays, Dr. Jason Bull, is a self-assured trial consultant. He is also a flirt.

CBS emphasized the character’s roguish side when it marketed the show in the summer of 2016. Billboards showed a close-up of Mr. Weatherly’s face behind a double entendre in huge red letters: “He’ll Get You Off.”

Ms. Dushku, 37, has been in show business for more than 20 years. In addition to her recurring role on “Buffy the Vampire Slayer,” she was a regular on the shows “Angel,” “Dollhouse” and “Banshee.” She became a voice in the #MeToo movement earlier this year when she claimed in a Facebook post that she had been molested by a stunt coordinator as a 12-year-old on the set of the 1994 movie “True Lies.” The stunt coordinator denied her allegations.

When Ms. Dushku signed on with “Bull” at $35,000 per episode — a figure that would have increased significantly, if she had continued on the show — there were “well developed plans” to have her become a regular cast member, according to the draft of the investigators’ report.

The investigation’s findings show how Ms. Dushku sought to address conduct she found demeaning, why she believed she faced retaliation and how a top CBS lawyer tried to undermine her claims with what investigators described as an “antiquated” view of how a woman should comport herself in the workplace.

On “Bull,” Ms. Dushku played J.P. Nunnelly, a criminal defense lawyer. Although she would have a running flirtation with Mr. Weatherly’s character, Mr. Caron, the producer, said that he “wouldn’t want intimacy” until the show’s fifth season, according to notes taken by a participant in an interview Ms. Dushku gave investigators in September.

But it wasn’t long before Mr. Weatherly started making comments that left her feeling uncomfortable. “Here comes legs,” he said on a day when Ms. Dushku was wearing a suit, according to the interview notes. On another occasion, Ms. Dushku told investigators, he said in front of the cast and crew that he would bend her over his leg and spank her.

In an interview, Mr. Weatherly said the remark about spanking was meant as a joke. “I ad-libbed a joke, a classic Cary Grant line from ‘Charade’ or ‘Philadelphia Story,’ and that meant not at all that that was an action I wanted to take,” he said.

Ms. Dushku also described to investigators a time on the set when, in character, she made a gesture with three fingers. In response, she said, Mr. Weatherly suggested — to laughs from the crew — that she wanted to have a threesome with him and another male cast member.

Ms. Dushku played J.P. Nunnelly, a criminal defense lawyer, on “Bull” last year.CreditDavid M. Russell/CBS

Because of his status on the show, his behavior was contagious, in Ms. Dushku’s view. She told investigators that a crew member approached her at one point and said with a chuckle, “I’m with Bull,” before suggesting that he, too, wanted to take part in a threesome with her.

The exchange left Ms. Dushku feeling “disgusting and violated,” according to the interview notes.

Mr. Weatherly said that when he mentioned a threesome, it was not to suggest Ms. Dushku take part in a threesome with him and another cast member. “While we’re shooting, in the context of the scene, she held up three fingers, suggesting something,” he said. “And I ad-libbed, ‘Threesome?’”

Then came the shooting of a scene involving a windowless van. With the cameras rolling, in front of the cast and crew, Mr. Weatherly said he would take Ms. Dushku to his “rape van,” which, he added, was filled with phallic objects and lubricant, according to the interview notes.

Mr. Weatherly said the “rape van” line was an attempted joke that misfired. “The scripted line in that scene was, ‘Hey, young lady, step into my windowless van,’” he said. “I didn’t particularly like that line, so I joked, in order to highlight how distasteful the emphasis of the line was, about an ‘r. van,’ a rape van. Which, in retrospect, was not a good idea.”

Ms. Dushku shared her concerns with Mr. Caron, who seemed receptive, according to the interview notes, and they agreed that she would approach Mr. Weatherly.

She began by telling Mr. Weatherly that “everyone loves” him on the set and followed his lead. She pointed out that after he made the threesome comment, a crew member said something similar to her, according to the interview notes. Mr. Weatherly asked Ms. Dushku who had made the remark and why she did not report it. As Ms. Dushku later told the lawyers, she did not have the sense that there was a “safe person you could go to” with that kind of complaint.

After the talk, Mr. Weatherly sent a text to David Stapf, the president of CBS Television Studios, saying that he wanted to talk about Ms. Dushku’s sense of humor. Mr. Stapf replied that Ms. Dushku made the show better, according to the interview notes.

Around the same time, Ms. Dushku expressed the worry to her representatives that Mr. Weatherly might go to CBS and get her fired.

That is effectively what happened. Within days of confronting Mr. Weatherly, Ms. Dushku was written off the show. The plan to make her part of the cast was over. By way of explanation, Mr. Caron told her that he “didn’t know how to write” her into the show anymore, according to the interview notes.

Mr. Weatherly denied pushing for Ms. Dushku’s removal. “It’s my recollection that I didn’t tell anyone how they should do their job regarding the hiring or firing of anybody,” he said.

Mr. Caron, who joined “Bull” in 2017 and later became its showrunner, said the decision to end Ms. Dushku’s run had nothing to do with her experiences on the set. “The idea that our not exercising her option to join the series was in any way punitive just couldn’t be further from the truth,” he said in a statement.

On one of her final days on “Bull,” Mr. Weatherly insisted that she stay for a champagne toast celebrating the wrap of another season. Ms. Dushku thought that was odd, because she would not be returning and had been open about the fact that she did not drink.

During the toast, Mr. Weatherly said he needed a “really beautiful woman” to grab a ticket for a raffle. “Eliza,” he said in front of everyone, according to the interview notes, “we need you, the most beautiful woman, to come grab the raffle ticket.”

Ms. Dushku, in her final moments as part of the “Bull” sphere, played along, although she felt “embarrassed and humiliated.”

Ms. Dushku told investigators that she relayed her experiences on “Bull” to Leslee Feldman, an executive at Amblin. “If Steven ever knew about this, he would be so horrified,” Ms. Feldman said, referring to Mr. Spielberg, the chief executive of Amblin Partners, according to what Ms. Dushku said during the interview. Amblin declined to comment.

After considering a lawsuit, Ms. Dushku entered into mediation with CBS. Mark Engstrom, the chief compliance officer at CBS, participated, along with Bettina B. Plevan, a partner at the law firm Proskauer Rose, who was serving as outside counsel for the company.

Mr. Engstrom handed over outtakes from “Bull” in the belief that they would help the company’s cause, because they showed Ms. Dushku cursing on the set, investigators wrote in the draft of their report.

The strategy backfired. The outtakes were a “gold mine” for Ms. Dushku, the lawyers wrote, because they “actually captured some of the harassment on film.”

Although the investigators praised Mr. Engstrom for his “tremendous institutional knowledge” and described him as a “smart and very capable lawyer,” they said the company’s failure to recognize the instances of harassment caught on tape was a symptom of larger problems at CBS, according to the draft of their report. Mr. Engstrom declined to comment.

Mr. Weatherly, Mr. Caron and Amblin Television were parties to the settlement agreement, which prohibited Ms. Dushku from discussing her experiences on the show in exchange for the $9.5 million payment.

The settlement agreement came about in January, when the #MeToo movement was on the rise, three months after the first articles on Harvey Weinstein’s alleged sexual misconduct appeared in The Times and The New Yorker.

A history of misbehavior and sexual harassment on the part of prominent men at CBS has come to light in the last 13 months. In addition to forcing the departure of Mr. Moonves, CBS has fired two other well-known figures: Charlie Rose, a co-anchor of “CBS This Morning,” who was accused of sexual misconduct by multiple women; and Jeff Fager, the longtime executive producer of “60 Minutes,” after he sent a threatening text message to a CBS reporter looking into allegations that he had engaged in sexually inappropriate workplace behavior.

Eight months after the settlement, when Ms. Dushku sat for the interview with the lawyers investigating CBS, she said she welcomed the chance to speak her piece. “You’re all I have at this point,” she told them. “My story is true and it’s really affected me, and I can’t talk about it.”