Sen. Cory Booker (D-NJ) on Thursday tried to paint CIA Director Mike Pompeo as a homophobe during his Secretary of State confirmation hearing, even though he has opposed the confirmation of openly gay Trump appointee Ric Grenell.

Booker referenced a speech Pompeo gave at a church three years ago when he quoted a pastor as saying, “America had worshipped other gods and called it multiculturalism. We’d endorsed perversion and called it an alternative lifestyle.”

“Is being gay a perversion?” Booker asked Pompeo.

The CIA director said when he was a politician, he did not think it was appropriate for same-sex couples to marry, and that he stood by that. However, he added he believed married gay couples should be treated with the “exact same set of rights.”

Booker cut him off, demanding to know repeatedly whether Pompeo, a conservative Christian, approved of “gay sex.”

“You believe gay sex is a perversion, yes or no?” Booker asked. “Yes or no, do you believe that gay sex is a perversion? … Yes or no, do you believe gay sex is a perversion?”

“My respect for every individual regardless of their sexual orientation is the same,” Pompeo was finally given the opportunity to answer.

Booker said as secretary of state, Pompeo’s views matter, since he would be representing the nation at a time where hate acts against gays were rising.

Yet, at the same time, Booker has staunchly opposed President Trump’s most prominent openly gay nominee Ric Grenell, as U.S. Ambassador to Germany — which would also be an position where he would represent the U.S. to the world.

Booker, as a member of the Senate Foreign Relations Committee, voted twice against confirming Grenell — once in October and again in January, despite overwhelming support for Grenell from gay rights groups.

Booker’s attempt to paint Pompeo as a bigot also comes after he endorsed former President Barack Obama for having the same views on gay marriage.

Obama famously stated in 2004, “What I believe is that marriage should be between a man and a woman.”

But in 2007, when he was mayor of Newark, New Jersey, Booker endorsed Obama, saying at a press conference, “Barack Obama is going to help ensure that the American dream — as bold and broad as it is — is accessible to all Americans.”

Obama stated his opposition again to same-sex marriage in 2010, saying he supported same-sex civil unions. It was not until 2012 that he said he supported same-sex marriages.