Former President Barack Obama on Saturday criticized a Republican candidate's opposition to marriage equality.

Obama made the comments while campaigning for Terry McAuliffe, the Democratic candidate for governor.

“Are we still arguing about gay marriage?” Obama rhetorically asked the crowd. “Really? I thought that ship had sailed. I thought that was pretty clearly the right thing to do.”

Obama was referring to McAuliffe's Republican opponent, Glenn Youngkin, who in a recent interview reiterated his opposition to marriage rights for gay and lesbian couples.

“Asked in the same interview whether his faith shapes his view of same-sex marriage, Youngkin responded with a vagueness common in his answers to questions about policy,” the AP reported. “He reiterated that he feels 'called to love everyone.' Pressed on whether that was intended to convey support for same-sex marriage, he responded: 'No,' before saying that gay marriage was 'legally acceptable' in Virginia and that 'I, as governor, will support that.'”

McAuliffe, who was Virginia's governor when gay couples won the right to marry in the state, criticized Youngkin in a tweet: “As governor, I worked my heart out to keep Virginia open and welcoming to all. This type of bigotry and intolerance has NO place in our Commonwealth.”

(Related: Biden endorses Danica Roem for re-election.)

McAuliffe was also the first gubernatorial candidate in 2013 to announce his support for marriage equality.

(Related: Texas GOP lawmaker argues state's same-sex marriage ban should trump SCOTUS ruling.)

A Monmouth University poll released last week shows McAuliffe and Youngkin deadlocked in the governor's race with both candidates at 46 percent support among registered voters.