The Biden campaign took aim at newly elected House Speaker Mike Johnson this past week over his views on "same-sex relations" but ignored past comments from President Biden on the same subject during his time in public office.

"Mike Johnson called for criminalizing gay sex," the Biden-Harris presidential campaign wrote Wednesday in a post to X, formerly known as Twitter. "Johnson called same-sex relations ‘inherently unnatural’ and said it could destroy ‘the entire democratic system.’ He railed against courts for ‘closing bedroom doors’ and upholding the right to privacy."

The post also included a link to a CNN article about the subject, which was titled "New speaker of the House Mike Johnson once wrote in support of the criminalization of gay sex."

Though the report claimed that Johnson "has a history of harsh anti-gay language," President Biden also has a history of making statements against gay marriage during his time as a senator from Delaware and also as Vice President of the United States — before he famously changed his position.

BIDEN GETS A PASS ON GAY MARRIAGE 'EPIPHANY'

Mike Johnson, President Biden

The Biden campaign took aim at newly elected House Speaker Mike Johnson this week over his views on "same-sex relations" but ignored past comments from President Biden on the same subject during his time in public office. (Getty Images)

In September 1973, while responding to a question about homosexuals serving in the U.S. civil service or the military, Biden suggested that homosexuals were "security risks."

Biden's comment at the time, according to Wilmington's The Morning News, came in response to a question from Robert Vane, a gay activist who questioned the then-senator about discrimination.

"My gut reaction," Biden told Vane at the time, "is that they (homosexuals) are security risks, but I must admit I haven't given this much thought . . . I'll be darned!"

In February 1993, Biden voted in favor of an amendment to codify the Department of Health and Human Services' prohibition of the permanent immigration of individuals who were HIV positive.

Following his vote, Biden claimed he was "ambivalent on the issue" but voted for the amendment anyway, saying the issue was "bigger than whether HIV should be on the list or off the list," according to a report at the time from The Washington Times.

The same year, Biden also voted for the National Defense Authorization Act of 1994, which included the "don't ask don't tell" policy that barred gay Americans from serving in the military.

Signed by then-President Bill Clinton in November 1993, "section 571 of the law, codified at 10 United States Code 654, described homosexuality in the ranks as an ‘unacceptable risk... to morale, good order, and discipline,'" according to the Congressional Research Service (CRS). "The law codified the grounds for discharge as follows: (1) the member has engaged in, attempted to engage in, or solicited another to engage in a homosexual act or acts; (2) the member states that he or she is a homosexual or bisexual; or (3) the member has married or attempted to marry someone of the same sex," CRS noted of the measure.

BIDEN TAKES HEAT FOR REPEATING STORY ON GAY MARRIAGE 'EPIPHANY': 'LIES ABOUT STUFF LIKE THIS CONSTANTLY'

Joe Biden, July 1993

In February 1993, Biden voted in favor of an amendment to codify the Department of Health and Human Services' prohibition of the permeant immigration of individuals who were HIV positive. (CQ Roll Call via Getty Images)

The Guardian reported in 2011 that approximately 14,500 individuals had been removed from the military for violating the "don't ask don't tell" policy from 1994 to 2011.

In August 1994, Biden joined 22 of his Democrat colleagues to vote in favor of an amendment that cut off federal funds to any school district that taught the acceptance of homosexuality as a lifestyle, The Associated Press reported at the time.

Biden has also held a variety of views on same-sex marriages, which have changed over time as he has worked to appeal to voters.

In 1996, Biden voted for the Defense of Marriage Act (DOMA), which amended "the Federal judicial code to provide that no State, territory, or possession of the United States or Indian tribe shall be required to give effect to any marriage between persons of the same sex under the laws of any other such jurisdiction or to any right or claim arising from such relationship."

Signed into law by Clinton on Sept. 21, 1996, the measure established a federal definition of "marriage" as "only a legal union between one man and one woman as husband and wife" and a definition of "spouse" as "only a person of the opposite sex who is a husband or wife."

Reiterating his support for the DOMA in 2004, Biden stated, "This has long been a state issue, and it should remain that way." Biden would later vote for the law, which defined marriage as between men and women for federal purposes, and explicitly permitted states to refuse to recognize same-sex unions in other states.

At the same time, he twice opposed an amendment to include a gay marriage ban as part of the Constitution.

In 2006, Biden told CNN: "Look, marriage is between a man and a woman. Tell me why [a constitutional marriage amendment] has to be put in the Constitution now? We already have a federal law that has not been challenged. No one’s declared it unconstitutional. It’s the law of the land, saying marriage is between a man and a woman."

Biden went on to doubt that it would constitute "discrimination" to define marriage as between men and women.

'SECURITY RISKS'? BIDEN'S PAST RHETORIC ON GAY RIGHTS COULD COMPLICATE LGBT CLAIMS ON CAMPAIGN TRAIL

Joe Biden, 2006

In 2006, Biden told CNN: "Look, marriage is between a man and a woman."

"Look, I don't — I don't know whether it would be writing discrimination into the Constitution," Biden continued. "But it doesn't warrant the Constitution. There's a lot of things that don't need to be in the Constitution. And what we have always — marriage has always been something we left to the states."

In June 2006, while speaking to NBC News' "Meet the Press," Biden was more forceful.

"You know, think about this. The world’s going to Hades in a handbasket," Biden told anchor Tim Russert at the time. "I can’t believe the American people can’t see through this. We already have a law, the Defense of Marriage Act. We’ve all voted — not, where I’ve voted, and others have said, look, marriage is between a man and a woman, and states must respect that. Nobody’s violated that law, there’s been no challenge to that law. Why do we need a constitutional amendment? Marriage is between a man and a woman."

During the 2008 presidential campaign, Biden maintained his opposition to gay marriage.

"I have to ask you this because it does affect me and my family directly," Biden was asked at a campaign event in Iowa in 2007. "But if, in the next five years, if you’re president, do you see gay marriage in the future?"

Biden responded: "I don’t. Here’s what I do see. I see an absolute guarantee of civil union with the exact same rights. Now, here’s the dilemma. Here’s the dilemma. The truth of the matter is, states have made legal, through licensing, the performance of marriage what religions have essentially consecrated. That’s how they view it."

During the October 2008 vice presidential debate, Biden vowed that "in an Obama-Biden administration, there will be absolutely no distinction from a constitutional standpoint or a legal standpoint between a same-sex and a heterosexual couple," but that "[neither] Barack Obama nor I support redefining from a civil side what constitutes marriage."

Moderator Gwen Ifill pressed: "Let's try to avoid nuance, senator. Do you support gay marriage?" Biden answered simply, "No."

Despite his past comments, Biden has claimed in recent years that he was one of the first leaders who held public office to support same-sex marriage.

"I was the first major leader holding public office to call for same-sex marriage. So I don’t know what about the past of Barack Obama and Joe Biden was so bad," Biden said in New Hampshire in February 2020, during his campaign for president.

Joe Biden campaign 2020

Despite his past comments, Biden has claimed in recent years that he was one of the first leaders who held public office to support same-sex marriage. (Drew Angerer/Getty Images)

CLICK HERE TO GET THE FOX NEWS APP

In March 2020, in Washington, D.C., Biden doubled down: "I’m the first person to go on national television in any administration and say I supported gay marriage. I supported gay marriage when asked. And so it started a ripple effect. I’m not taking all credit for it, but I’m the first major player to say I support gay marriage on national television."

However, major figures from both parties had already done so, including Dick Cheney and Rep. Nancy Pelosi, D-Calif.

When reached for comment, Johnson's office pointed Fox News Digital to comments he made during a recent appearance on Fox News Channel's "Hannity" about the matter.

"I respect the rule of law. When the Supreme Court issued an opinion, that became the law of the land," Johnson said. "I respect the rule of the law, but I also genuinely love all people regardless of their lifestyle choice."

Biden's campaign did not immediately respond to Fox News Digital's request for comment.

Gregg Re contributed to this report.