C-SPAN Howard Nielson once questioned a federal judge's impartiality because he was gay. Now Nielson gets to be a federal judge.

The Senate voted Wednesday to confirm Howard Nielson to be a lifetime federal judge, despite opposition from Democrats over his long record of fighting marriage equality and for writing a legal memo that justified torturing civilians.

The Senate voted 51-47 to confirm Nielson, 51, to the U.S. District Court for the District of Utah. Every Democrat present opposed him. Every Republican present but one, Sen. Susan Collins (Maine), voted for him. Sens. Kamala Harris (D-Calif.) and Thom Tillis (R-N.C.) did not vote.

Nielson, a partner at the Washington, D.C.-based law firm Cooper & Kirk and a former deputy assistant attorney general under President George W. Bush, sparked controversy in 2010 during his defense of Proposition 8, California’s ban on same-sex marriage. At the time, the state’s governor and attorney general refused to defend Prop 8, so the official sponsors of the ballot initiative hired Nielson’s firm to do it. The matter went all the way to the Supreme Court, which in 2013 effectively overturned the ban.

In that case, Nielson argued that sexual orientation is a choice and disputed the evidence that discrimination against LGBTQ people leads to higher rates of depression and suicide.

When a U.S. district court ruled that Prop 8 violated the Constitution, Nielson said the judge should have recused himself because he was gay and therefore unable to be fair. He filed a motion saying the judge “had a duty to disclose not only the facts concerning his [same-sex] relationship, but also his marriage intentions.” His motion was denied.

Nielson argued against marriage equality again in a 2015 amicus brief in Obergefell v. Hodges, the Supreme Court decision that legalized same-sex marriage nationwide. He argued that marriage has a defining purpose “to increase the likelihood that children will be born and raised in stable and enduring family units by both the mothers and the fathers who brought them into this world.” The Supreme Court rejected that argument.