Bruce L. Castor Jr. thrived on locking up criminals, once winning five first-degree murder convictions in a year.

He spoke his mind. He fought with fellow Montgomery County commissioners who forged an alliance against him. He had ambitions of becoming governor.

Now, Castor's action-packed career in public office is coming to a quiet close.

The confident, spotlight-loving, cowboy-boot-wearing Republican lost a race this fall to return to his former position as district attorney.

"I felt like a gigantic weight was lifted off of me," Castor said of losing the hotly contested and expensive race to Democrat Kevin Steele.

His January retirement to private law practice will mark the first time since 1986 that Castor has not worked for Montgomery County.

"There are too few people who stand in the middle . . . and work to just truly solve problems for the people they serve," said Democratic Commissioner Josh Shapiro, who ran a heated campaign for commissioner against Castor in 2011 before working alongside him for four years. "Bruce Castor is one such person."

Castor, 54, will take with him his leather office chair - which Shapiro gave him during his final commissioners meeting - and 30 years of memories.

Sitting in that chair in his Ardmore law office last week, surrounded by awards from his days as district attorney, Castor reflected on his years as a prosecutor and politician.

Less than a year after joining the District Attorney's Office, he was assisting Thomas Waters, then the district attorney, in a double death-penalty case for the murders of a renowned Temple University Islamic scholar and his wife.

"All of a sudden, Mr. Waters thought I was like the cat's meow, and I'm getting all these great cases," Castor said.

Castor's love of horseback riding - he worked herding cattle while in law school - boosted what he called his "meteoric rise" through the ranks of the District Attorney's Office. He rode horses "too dangerously," according to friends in Montgomery County, he said, but met Michael Marino, then a defense lawyer "who also rides like a maniac." When Marino became district attorney in 1988, he immediately promoted his riding companion.

A courtroom defeat

Castor was known for prosecuting murderers. Among them: Caleb Fairley, convicted of killing a woman and her baby; Guy Sileo Jr., convicted of shooting his business partner in Lower Merion's General Wayne Inn; Rafael Robb, a University of Pennsylvania professor who pleaded guilty to bludgeoning his wife.

But he never forgot his most notable loss. Patricia Swinehart was acquitted in 1994 of arranging the murder of her estranged husband.

"I made a mistake in that case," Castor said, in failing to appeal a judge's ruling blocking evidence that the victim was killed the day before he planned to change his will to exclude his wife.

In another case, Castor said he still believes that his decision against arresting Bill Cosby in 2005 was not a mistake.

Temple University employee Andrea Constand told police Cosby drugged and molested her at his Cheltenham mansion in 2004. Castor declined to charge the comedian, citing insufficient evidence.

The case was reopened this summer by the District Attorney's Office after a deposition Cosby gave in Constand's civil lawsuit against him became public and dozens of other women had come forward with similar allegations.

Cosby became the central issue in the race for district attorney this fall when Steele, the first assistant district attorney, ran TV ads attacking Castor's 2005 decision.

But Castor's involvement with Constand and the Cosby case is not over.

"I have to worry about my own situation - the woman is suing me," he said, referring to the defamation lawsuit Constand filed against Castor this fall alleging he twisted facts and undermined her credibility for his own political gain.

Castor called the lawsuit an attempt to influence the election.

A loss to Corbett

This year's district attorney's race was not the only election Castor lost. He ran for state attorney general in 2004 and said he was "seduced" by the idea of later becoming governor. He lost the primary to Tom Corbett.

Today, Castor insists he would be governor if he had not lost the 2004 primary. He also tried to challenge Corbett in a 2014 Republican primary for governor. He summed up the response he got from his party as: "The heck with you."

Castor surprised colleagues in the District Attorney's Office in 2007 when he decided to run for county commissioner, still with hopes of running for governor one day. But after Castor's victory, Jim Matthews, his fellow Republican commissioner, formed an alliance with Joe Hoeffel, the Democratic commissioner, to outvote Castor. Public meetings turned into shouting matches.

During those years, Castor kept, in a frame above his office toilet, the certificate showing he had won the most votes in 2007. When Matthews was arrested in 2011 and accused of lying to a grand jury investigating the board of commissioners, Castor said, "I moved it out of the bathroom."

The charge against Matthews was dismissed after he entered the accelerated rehabilitative disposition program and agreed to donate $12,000 to a nonprofit.

Castor was reelected commissioner in 2011, finishing third behind Democrats Shapiro and Leslie Richards. He got along well with his Democratic colleagues.

With a Democratic majority in Montgomery County, Castor said Republicans will struggle to win county or statewide office. "The Republican Party is dead in Pennsylvania, never to rise again," he said.

Castor declined to make a statement as strong about the fate of his own political career. For now, he said, "I've had enough of being in government."

610-313-8116 @Lmccrystal

Correction: A previous version of this story incorrectly reported the outcome of a criminal case against former Commissioner Jim Matthews. A false swearing charge against Matthews was dismissed after he entered the accelerated rehabilitative dispositon program and agreed to donate $12,000 to a nonprofit.