In the lawsuit, filed this week in Philadelphia County, former Montgomery County District Attorney Bruce Castor alleges that Andrea Constand and her lawyers orchestrated a smear campaign, including a defamation lawsuit of their own against Castor, that cost him the 2015 election to Kevin Steele, who is now the county district attorney.
"These defendants continued their smear campaign against Castor, all with the intent of getting Cosby convicted and Castor's political career destroyed," Castor’s suit alleges.
His lawsuit adds, "The Defendants continued their scheme and plot to permanently harm Castor by filing a tactically timed, patently frivolous and knowingly false lawsuit against Castor, seeking hundreds of thousands of dollars, alleging ‘defamation’ and ‘false light,’ in spite of them knowing that Castor’s statements at issue were true, and in spite of everything he did to enable Ms. Constand and her lawyers to handsomely profit from the civil lawsuit."
Castor also alleges in his lawsuit that Constand and her lawyers sued him a week before the election in 2015 to "destroy his political and legal career."
Constand's defamation lawsuit against Castor, which alleges that he misrepresented the facts about her case to further his political aspirations, is still pending.
Castor declined to comment to ABC News, while Constand’s lawyers did not immediately respond to a request for comment.
During the 2015 campaign, Steele criticized Castor for his handling of the Cosby case. He accused Castor in one ad of failing to bring criminal charges against Cosby and "not looking out for the victims."
Castor fired back, calling the accusation "despicable, desperation politics, disgusting lies," according to The Montgomery News.
Steele did not immediately respond to ABC News’ request for comment.
Castor, the then-district attorney in Montgomery County, decided not to press charges, explaining that Constand and Cosby could be portrayed in "a less than flattering light."
He had also concluded that Constand’s story contained too many inconsistencies to sustain a prosecution.
Constand then filed a civil lawsuit against Cosby in which he was deposed in September 2005 and March 2006. During the deposition, Cosby admitted to giving Quaaludes to another woman years before with whom he wanted to have sex. He also defended himself against Constand's allegations.
"I don’t hear her say anything. And I don’t feel her say anything," Cosby said. "And so I continue and I go into the area that is somewhere between permission and rejection. I am not stopped."
The civil case was settled confidentially and sealed on Nov. 8, 2006.
Cosby paid a settlement to Constand "well into the millions of dollars," according to the Castor lawsuit filed this week.
His deposition was later unsealed in July 2015 after The Associated Press asked the court to open up a portion of it. The newly elected Steele then charged Cosby in December 2015 for allegedly drugging and sexually assaulting Constand. The comedian has pleaded not guilty.
The case ended in a mistrial this June after six days of deliberation, but Steele’s office said it plans to retry Cosby next spring.