SALT LAKE CITY — A former Disney Channel actor accused of enticing a 13-year-old boy for sex claims he can’t get a fair trial because the federal judge in his Utah case has a bias against gay people.

But U.S. District Judge Howard Nielson Jr. refused to recuse himself, saying the assumptions that Stoney Westmoreland made about him from past legal work don’t reflect his personal views.

“I can state categorically and unequivocally that I do not harbor any personal bias or prejudice concerning Mr. Westmoreland,” Nielson wrote in his order denying the motion earlier this month.

Also, Westmoreland, 49, could be back in jail for allegedly violating the conditions of his release pending trial in March. He is scheduled to appear in court regarding that matter next week.

In court papers, Westmoreland’s federal public defender argues that Nielson can’t be impartial because he represented the proponents of California’s Prop 8 as a private attorney. Nielson argued that homosexuality is a choice and that people who are homosexual can become heterosexual via conversion therapy, defense attorney Wendy Lewis wrote in court documents filed last month.

Lewis also notes that several members of Congress opposed Nielson’s appointment to the federal bench because they believed he is biased against gay people.

Westmoreland is bisexual, according to court documents. Though the charges against him aren’t focused on homosexuality, Lewis wrote, the gay lifestyle, particularly the “hook-up culture” which is “distinctly nontraditional,” will be part of the trial.

“The case will involve a detailed examination of the hook-up culture for homosexual men, how it works and what it means psychologically,” Lewis wrote. A number of witnesses, she said, are likely to be gay men who testify about Westmoreland’s background, including his transition from a heterosexual marriage to being “an out, homosexual man.”

In rejecting the motion to remove himself, Nielson wrote that Westmoreland assumes that the views of his former clients and the positions that he took on their behalf reflect his personal beliefs. Westmoreland also assumes those positions would determine or improperly influence his conduct and rulings as a judge.

“Neither assumption is reasonable,” the judge wrote.

“Indeed, even if I in fact held the personal views that defendant imputes to me based on positions that he believes I advanced on behalf of my clients — and I do not — a reasonable person would not assume that as a judge I would follow those views rather than the law that I have sworn to uphold.”

Nielson wrote that statements made by members of Congress who opposed his nomination provide no grounds for his recusal. Someone knowing all the relevant facts would not conclude that politicians’ words reflect his views or indicate how me might rule in any particular case, he wrote.

Senate Democrats grilled Nielson, the son of former Utah GOP Congressman Howard Nielson, over his role in the Prop 8 case in a committee hearing.

Nielson told lawmakers that the positions he took in litigation “are those of my clients,” not his own. He said he was “a junior member of a legal team” in the Prop 8 case and the lead counsel ultimately made the decisions on what arguments to advance.

The Senate confirmed Nielson in May on a 51-47 vote amid opposition from Democrats and LGBTQ advocates.

Westmoreland is “extremely concerned” that he will not get a fair trial, Lewis wrote. Neilson’s involvement in the Prop 8 case put him “squarely in the middle of a highly charged and highly sensitive issue,” she wrote.

Fair or not, Lewis wrote, there is now a perception that the judge has certain prejudices regarding homosexuality.

Westmoreland was fired from his grandfather role on the made-in-Utah Disney Channel series “Andi Mack” after his arrest last December. His film credits include “Godzilla” and “Matchstick Men.”

Westmoreland attempted to meet with a 13-year-old boy and take him back to his room at the Little America Hotel, according to court documents. The “boy,” however, was an undercover police officer who Westmoreland allegedly communicated with on the app Grindr.

A federal magistrate released the actor from jail under certain conditions in February following his arrest on one count of coercion and enticement. Magistrate Judge Cecilia Romero added new conditions in September, and warned Westmoreland that she would would put him in jail if he didn’t meet them.

Federal prosecutors say Westmoreland violated two of those terms when he allegedly denied pretrial officers access to his roommate’s room in their Los Angeles home and missed a deadline to provide the court an inventory of his digital media.

A hearing is scheduled before Romero on Jan. 3.