Washington • On a nearly party-line vote, the Senate on Wednesday confirmed a controversial nominee to serve as a federal judge in Utah, with all Democrats and one Republican opposing Howard Nielson for the lifetime job.

Nielson, the son of former Utah Rep. Howard Nielson, came under fire by critics for his past work in George W. Bush’s Justice Department that offered legal opinions to justify enhanced interrogation techniques that some consider torture.

Nielson didn’t write the memos on the techniques — and supported overturning them — though he authored another one that said the Geneva Conventions only protected civilians in enemy custody held on American soil and not elsewhere. That memo is seen as leading to the other enhanced technique guidance.

Nielson also faced opposition for his previous legal work to end same-sex marriage in California.

The Senate confirmed him 51-47, with Sen. Susan Collins, R-Maine, joining Democrats voting against Nielson.

(Courtesy Photo) Howard Nielson.

Sens. Mike Lee and Mitt Romney, both Utah Republicans, supported Nielson’s nomination by President Donald Trump.

“It was an honor to help confirm Judge Nielson to the United States District Court for the District of Utah,” the senators said in a statement. “He is an extremely qualified nominee and will serve the court with honor and integrity.”

Senate Majority Leader Mitch McConnell, a Kentucky Republican who has pushed to confirm a long list of Trump's choices for the judiciary, including two justices on the Supreme Court, said Nielson had “assembled an impressive record at the Department of Justice and in the private sector” and touted other nominees up for a vote Wednesday as well.

“If I’m sounding like a broken record, it’s because the White House continues to submit one extremely well-qualified and highly impressive nominee after another to sit on the federal bench,” McConnell said. “These are men and women who are bright, talented, well-regarded, and committed to applying what the text of our laws and our Constitution actually say.”

The Human Rights Campaign had urged senators to vote Nielson down, saying that his nomination was “yet another attack on LGBTQ people by the Trump-Pence Administration.”

“Nielson has a long track record of hostility and discrimination towards the LGBTQ community,” said Sarah Warbelow, the group's legal director. “He has stated that being gay is a choice, argued in favor of Prop 8 and the abusive practice of conversion therapy, and had the audacity to claim a gay judge could not be impartial in a ruling involving LGBTQ rights.”

The gay rights group noted that Nielson had argued in a court filing in California’s Proposition 8 case that the judge, who is gay, had a personal conflict because he was in a long-term same-sex relationship.

Carl Tobias, a law professor at the University of Richmond who tracks judicial nominees, said the vote was close but “GOP lockstep voting meant that the Senate confirmed Nielson.”

Tobias noted that Nielson’s involvement in controversial issues was fully vetted at his hearings but McConnell kept his GOP ranks in check for the most part.

Nielson, who earned his bachelor’s degree at Brigham Young University and is now a lawyer in Washington, will replace federal Judge Ted Stewart, who took senior status in 2014.