WASHINGTON — A White House lawyer won Senate confirmation as a federal appeals court judge Thursday despite complaints by lawmakers from both parties about his record on immigration, race, women’s equality and LGBTQ rights.

Steven Menashi, an associate White House counsel, was confirmed by a 51-41 vote for a seat on the New York-based 2nd U.S. Circuit Court of Appeals.

Maine Sen. Susan Collins was the sole Republican to oppose Menashi, a 40-year-old New Yorker who has never tried a case or argued an appeal.

Sasha J. Buchert, senior attorney at Lambda Legal, an LGBTQ legal advocacy group, called Menashi "one of President Trump’s most dangerous and alarming judicial nominees to date."

"Mr. Menashi’s disqualifying record is not only plagued with bias against LGBT rights, but he also has actively undermined the rights of immigrants, women, students, and other vulnerable groups throughout his career," Buchert wrote. "This record clearly demonstrates that he would to be unable to administer fair and impartial justice."

Lambda Legal pointed to a letter the group signed along with 20 other LGBTQ advocacy organizations opposing Menashi's confirmation. Among the groups' concerns was how Menashi “unambiguously asserted his opposition” to same-sex marriage ahead of the 2015 Obergefell v. Hodges decision, a landmark Supreme Court ruling that legalized gay marriage across the U.S.

Human Rights Campaign President Alphonso David said Menashi is "yet another extremist" appointee and said he has "used whatever platform he’s handed — from his college newspaper, to legal publications, to a seat at the table at the White House — to undermine our community’s fight for equality."

Republicans and Democrats complained that Menashi failed to answer questions at his nomination hearing, and Collins joined Democrats in criticizing Menashi’s record on a range of issues, including immigration, race, women’s equality and LGBTQ rights.

Senate Democratic leader Chuck Schumer of New York called Menashi a “disgrace” and ''one of the most contemptible nominees to come before the Senate” in more than 20 years.

As a lawyer for Education Secretary Betsy DeVos, Menashi “helped cook up an illegal scheme to use the Social Security data of students swindled by for-profit colleges in order to deny them debt relief,’’ Schumer said, noting that a federal judge ruled the plan violated federal privacy laws.

Schumer, who has railed against many judicial appointments by President Donald Trump, said Menashi stands out as extreme, unqualified and “almost craven. If there was ever anyone who was too far, it’s Menashi.’’

Senate Majority Leader Mitch McConnell, R-Ky., called Menashi an “impressive nominee,’’ citing his degrees from Dartmouth College and Stanford Law School, clerkships for federal judges including Supreme Court Justice Samuel Alito, and experience teaching and practicing law.

Other Republicans were more skeptical.

Senate Judiciary Committee Chairman Lindsey Graham, R-S.C., said Menashi “has written some really weird stuff” and is “different than I would have chosen,” but is qualified for the federal bench.

Graham was one of several senators who expressed frustration at Menashi’s refusal to answer questions about his record at the White House and the Education Department during his confirmation hearing in September.

Sen. Dianne Feinstein of California, the committee’s top Democrat, said Menashi’s silence made it difficult for senators to fulfill their constitutional role to provide advice and consent on presidential nominees.

She and other Democrats were especially unhappy about Menashi’s role in denying debt relief to thousands of students swindled by for-profit colleges. “Mr. Menashi should not be rewarded for providing such bad legal advice with a lifetime appointment to the federal bench,’’ Feinstein said.

Menashi’s “troubling record of undermining critical rights and questions surrounding his involvement in Secretary DeVos’s shameful efforts to ignore the law” disqualify him from a lifetime judgeship, added Sen. Patty Murray, D-Wash.

Collins said Menashi’s past writings, particularly about women, LGBTQ advocates and racial diversity, raise questions about whether he has the appropriate judicial temperament.

Collins, one of the most vulnerable GOP incumbents next year, said it was inappropriate for Menashi to refuse to answer questions about his work in the Trump administration during his confirmation hearing.

“His reluctance to answer questions about the family separation policy made it difficult for me to assess his record and impeded my constitutional duty to evaluate his fitness to serve as a judge,’’ she said in a statement. “After careful consideration ... I do not believe he is well-suited to serve on the federal bench.”

Menashi is among more than 150 federal judges nominated by Trump and confirmed by the Senate, including at least 46 appeals court judges. About one-quarter of federal appeals court judges were nominated by Trump.

Follow NBC Out on Twitter, Facebook & Instagram