An anti-gay lawyer was confirmed to lead the Department of Justice’s Civil Rights Division.

In a 52-45 vote, the Senate confirmed Donald Trump’s nominee, Eric Dreiband.

He will now head up the Department of Justice’s efforts to fight racism, homophobia, and other forms of discrimination, even though he has spent his life defending discrimination.

Dreiband represented the University of North Carolina in a lawsuit against the school’s decision to enforce HB2, which restricted bathroom access for trans people and banned local governments from passing LGBTQ anti-discrimination ordinances.

Related: Department of Justice intervenes in case to argue gays don’t have civil rights

He also defended R.J. Reynolds Tobacco Company and Bloomberg in discrimination cases, and represented clients looking for religious exemptions to the law.

“Whoever leads the ‘crown jewel’ of the Justice Department must have deep relationships with stakeholders and marginalized communities, and have a deep, abiding faith in our nation’s civil rights laws,” said Vanita Gupta, who headed the Civil Rights Division under Barack Obama.

“They must respect the laws that touch everyone, rights that people have literally died for. They must respect the role of what has been called the conscience of the federal government. In all those regards, Eric Dreiband is woefully unqualified to lead the Civil Rights Division.”

Lambda Legal pointed to the Civil Rights Division’s role in defending civil rights as a reason to be concerned about Dreiband.

“Throughout its 60-year history, the Department of Justice’s Civil Rights Division has been a stalwart defender of civil rights in employment, education, housing, voting and many other aspects of life,” said Lambda Legal’s Sharon McGowan, who added that Dreiband was not “a strong leader with a proven track record of defending civil rights.”

The NAACP said that Dreiband was “exactly the wrong choice” to lead the office.

“The evidence is clear,” NAACP board chair Leon W. Russell said in a statement. “For the past 20 years, Dreiband has been on the wrong side of issues pertaining to housing, hate crimes and the many other critical areas that the Civil Rights Division oversees as part of its core mission.”

Under Attorney General Jeff Sessions, the Justice Department has made protecting religious liberty a priority at the expense of LGBTQ equality.

Earlier this year, Sessions announced the creation of a Religious Liberty Task Force to help fight against anti-discrimination efforts.