"I consider it a privilege to represent the 45th President. The strength of our Constitution is about to be tested like never before in our history. It is strong and resilient. A document written for the ages, and it will triumph over partisanship yet again, and always," said Castor in a statement last week.
Castor was the district attorney of Montgomery County, Pennsylvania from 2000 to 2008, before serving two terms as the county commissioner.
In 2005, Castor declined to prosecute Bill Cosby after Andrea Constand reported the actor had touched her inappropriately at his home in Montgomery County, citing "insufficient credible and admissible evidence."
Cosby was later tried and convicted in 2018 for drugging and sexually assaulting Constand at his home in 2004, despite the fact that Castor argued during a pre-trial hearing that he'd already committed the state to not prosecuting the actor.
In 2004, Castor ran for state attorney general unsuccessfully against Tom Corbett in the GOP primary.
SEE ALSO: Trump's 2nd impeachment trial to start today with fight over its legitimacy
The Abington Township native ran for Montgomery County district attorney again in 2015, and his judgment in the Cosby case was a key issue used against him by Democrat Kevin Steele who defeated him.
Constand sued Castor in 2015, alleging defamation and false light. Her lawsuit claimed Castor gave various interviews with media outlets and directly or indirectly implied she had been inconsistent in her accusations against Cosby and "exaggerated her claims in a lawsuit and therefore was not to be believed."
In response to the suit, Castor alleged his opponent was behind the lawsuit, which was later settled, according to The Washington Post.
Castor later sued Constand and her attorneys, claiming they ruined his political career, among other things, in order to help get his opponent elected, a suit that was ultimately thrown out, according to The Washington Post.
In 2016, he became Solicitor General to the state's embattled attorney general - Kathleen Kane, a Democrat - as she faced charges of leaking protected investigative information to smear a rival and lying to a grand jury about it. She was convicted, leaving Castor as the state's acting attorney general for a few days.
Castor, who holds a law degree from Washington and Lee University, recently joined a law firm that had brought a case against the US Postal Service in 2020 in which lawyers said then-President Trump had "no evidence" for his claims of widespread voter fraud.
The CNN Wire contributed to this report.