Former Cook County Judge Pat O’Brien, once a high-ranking county prosecutor, said Friday he plans to run against State’s Attorney Kim Foxx as a Republican, offering a stinging assessment of the first-term incumbent as “unfit” for the job.

Under Foxx, O’Brien argued, “The only people who can say they are safer are the people committing crimes.”

O’Brien, 69, filed paperwork this week with the State Board of Elections to form a campaign fundraising committee and made clear in an interview he’s well past testing the waters.

“I’m in,” O’Brien said.

O’Brien was elected judge as a Democrat in 2006. He indicated his switch to the Republican Party has more to do with political calculation than any change in philosophy.

“I think my best opportunity to win is in the general election,” O’Brien said, explaining he expects Foxx will receive the endorsement of the Cook County Democratic Party organization and win the March 17 Democratic primary.

Running countywide as a Republican is always an extreme long shot. Only two Republicans have been elected state’s attorney in the last half century — Bernard Carey in 1972 and Jack O’Malley in 1990. Each was re-elected once.

The demographics favoring Democrats have become even more daunting in the years since.

But perceived voter dissatisfaction with Foxx over the Jussie Smollett case continues to embolden both Democrats and Republicans to consider challenging her.

O’Brien’s criticism of Foxx extend beyond Smollett.

“It’s upside down that there’s more concern about people who break the law than for people who are victims of crime,” he said.

Still, he indicated the Smollett case is a “microcosm” of why Foxx “is unfit to be state’s attorney.”

“She lacked common sense to understand his story could not be true as he told it,” O’Brien said, also criticizing Foxx’s efforts to have Chicago police turn over their investigation to federal authorities and for what he called her “phony recusal.”

In a written response, Foxx said she is proud of her accomplishments and “welcomes the opportunity to share my record with the public.”

She noted Cook County was once known as the “False Confession Capital of the World,” a likely swipe at O’Brien, who prosecuted four young men for the 1986 murder of medical student Lori Roscetti, only to see them later cleared on the basis of DNA evidence.

O’Brien came to work for the state’s attorney office under Carey and later served as O’Malley’s top deputy for criminal prosecutions before exiting the office in 1993.

In between, he did a stint as a prosecutor for the Illinois attorney general’s office, where he was hired under Republican Ty Fahner. O’Brien also served under Democrats: Attorney General Neil Hartigan and State’s Attorneys Richard M. Daley and Cecil Partee.

He spent 13 years as a criminal defense lawyer before going on the bench.

O’Brien’s legal experience arguably would make him the most qualified state’s attorney candidate Republicans have fielded in decades, but it remains to be seen whether he has the fundraising support to be competitive.

O’Brien said he’s already hired a campaign consultant, Dennis Cook of Strive Strategies Group, who he credits with helping elect DuPage County State’s Attorney Robert Berlin.

O’Brien said he is not related to retired state Appellate Justice Sheila O’Brien, who successfully sought the appointment of a special prosecutor to investigate how Foxx’s office handled the Smollett prosecution.