“Certain issues get picked as key debates about a civilization — as symbolic messages,” said Miguel Vale de Almeida, a university professor who served in Parliament with the Socialist Party as the legislative body’s only openly gay member, from 2009 until earlier this year. Promotion of same-sex marriage branded the party as adaptable and future-oriented.

Portugal was (and to some extent still is) playing catch-up. Its ban on abortion was overturned only four years ago. And in Portugal it remains illegal for a woman without an actual or common-law husband to receive fertility treatments or adopt.

Even same-sex marriage happened not as a reflection of, but in spite of, public opinion polls. As Sócrates and others recall, those polls, in 2009, suggested that support for it was about 40 percent at best.

But Sócrates nonetheless pledged during a re-election campaign that year to legalize same-sex marriage. To his mind it wouldn’t be a pivotal enough concern to turn away voters otherwise supportive of him and the party. Besides, he said, it was a matter of justice.

“It’s the obligation of my generation,” he said, then mentioned two personal influences. A secondary-school classmate, who had been presumed gay and teased about it, committed suicide in his mid-20s. And the movie “Milk,” released near the start of his re-election campaign, rekindled that memory and fortified his resolve, which survived opponents’ insinuations that Sócrates, single since a divorce many years earlier, must be gay.

THAT opposition wasn’t as furious as it would be in America, partly because of differences between Portuguese Catholics and our religious right. “With Catholics here there’s a sense of, ‘Do what you want, just don’t talk too much about it,’ ” said Paulo Côrte-Real, a leading gay rights advocate in Portugal. While that didn’t incline devout Catholics toward supporting same-sex marriage, it diminished their appetite for getting into a huge sustained public fight over it.

And once it became law, everyone for the most part moved on. Sócrates’s government was tripped up by economic matters, not same-sex marriage, support for which rose significantly in polls following its institution, as people saw that their society wasn’t crumbling as a result. “It was a good example of the pedagogical effect of law,” Vale de Almeida said.