BURLINGTON, Vt. — As Senator Bernie Sanders tries to distinguish himself from Hillary Rodham Clinton and rally his progressive base, one issue where he has claimed a clear advantage is in the long battle over gay rights.

Mr. Sanders has highlighted his opposition to the 1996 Defense of Marriage Act, which denied federal recognition to same-sex marriages, saying he thought couples should be able to “get married regardless of their sexual orientation.” In a recent interview, he said that “without tooting my own horn,” his opposition to the act, which was signed by President Bill Clinton, “means that somebody has got to take leadership,” and he told Gail Collins, a columnist for The New York Times: “I’m not evolving when it comes to gay rights. I was there!”

But on his home turf in Vermont, the first state to recognize civil unions and a trailblazer in same-sex marriage rights, gay rights advocates say Mr. Sanders was less than a leader, and not entirely present, on the issue.

Mr. Sanders, who first publicly endorsed gay marriage in 2009, expressed varying levels of support for gay rights as he rose from the mayor of liberal Burlington to a congressman and then a senator with statewide support among more socially conservative constituencies such as hunters, blue-collar workers and older voters.