GLASGOW — A popular tabloid called Patrick Harvie, the leader of the Scottish Green Party, a “Green threat to the family” when he ran for Parliament in 2003 — not because of his politics but because he is bisexual. When Ruth Davidson became the first openly gay leader of the Scottish Conservative Party in 2011, she was labeled the “kickboxing lesbian.”
By the time Kezia Dugdale, the leader of the Scottish Labour Party, came out in April, it was hardly considered news at all.
In the span of a generation, Scotland has shed much of its traditional social conservatism and enthusiastically embraced diversity in sexuality, a process led and reinforced by a remarkable transformation in its political culture.
Homosexuality was illegal in Scotland until 1980 — in England it was decriminalized in 1967 — and as recently as 2000, billboards financed by a Christian millionaire campaigning to uphold a ban on schools’ talking about homosexuality urged Scots to “Protect Our Children.”
Today, in addition to the leaders of three of the five major political parties in Scotland, four ministers in the Scottish government are openly gay, as is the secretary of state for Scotland in Britain’s Conservative government. The one elected representative of the right-wing U.K. Independence Party in Scotland is gay, too.
Of the 129 members of the Scottish Parliament, a legislative assembly with far-reaching autonomy from London, 10, or nearly 8 percent, identify as gay, lesbian or bisexual, by one tally the highest known proportion for a national legislature anywhere.
“Scotland has the gayest Parliament in the world,” said Andrew Reynolds, a professor at the University of North Carolina at Chapel Hill who keeps track of the political representation of those who identify publicly as lesbian, gay, bisexual and transgender, or L.G.B.T., across the world. By contrast, the United States Congress, representing a population 60 times Scotland’s, has six elected House members and one senator who are openly gay, lesbian or bisexual.
But the shift in Scotland has also reflected trends closer to home. Scotland’s Parliament is young. Established in 1999 as part of a deal to devolve more power from London, it has given a platform to a new generation that grew up with greater tolerance about sexuality; has made politicians, because they are in Edinburgh, more accessible to interest groups like L.G.B.T. advocates; and has injected new energy and pride into Scottish politics. In turn, the openly gay politicians who have emerged since then have helped champion L.G.B.T. rights.
“It’s a big cultural shift,” said Ms. Dugdale, who became engaged to her girlfriend this summer. “When you say you’re gay, people just shrug their shoulders. There is almost a feeling of ‘so what?’”
Scotland has long voted to the ideological left of England. It was a stronghold of the Labour Party before Scottish voters switched to the even more left-wing Scottish National Party, now the dominant political force. But a mix of Calvinism and Catholicism meant that on issues like abortion, divorce and homosexuality, Scotland remained more conservative than England for decades. The Scottish nationalists were once known as the “Tartan Tories.”
Now they are the third-largest party in the British Parliament in London, and eight of their 56 members of Parliament are openly gay, bisexual or lesbian, a higher proportion than in the other main parties.
“I’m very proud to be the leader of the gayest parliamentary group in the world,” Angus Robertson, the (straight) deputy leader of the Scottish National Party, declared this month. His campaign manager, Nathan Sparling, regularly performs in drag at G-A-Y, one of London’s best-known gay clubs. At the party’s annual conference in Glasgow this month, Mr. Sparling hosted a karaoke night dressed up as his alter ego, Nancy Clench.
Ms. Davidson of the Scottish Conservatives, a churchgoing Presbyterian who trained for Britain’s Army Reserve and once cheerfully described herself as a “flat-shoed, shovel-faced lesbian,” cut her hair shorter than it had ever been when she first ran for office. “I wanted to make sure people knew what they were getting,” she said.
Since then, five other Scottish Conservative Party politicians have come out, her partner has appeared with her in campaign broadcasts, and her party overtook the Labour Party as the main opposition party in Scotland for the first time. The church she attends flies a rainbow flag on its communion table.
“We’ve come a very, very long way in a really short time,” she said.
There is still more to do, Ms. Davidson and others said. Bullying in schools remains a problem, particularly for transgender teenagers. Hate crimes against L.G.B.T. people are up by 20 percent over the past year, according to Stonewall Scotland, an L.G.B.T. advocacy group, although that also reflects the fact that reporting rates have increased.
But the changes in politics, policy and culture have been striking.
One of the first things lawmakers did after the creation of the Scottish Parliament in 1999 was to repeal legislation barring schools from “promoting homosexuality,” a law that had effectively muffled any discussion of L.G.B.T. issues in schools. It was an ugly fight, with homophobic slogans splashed across front pages and billboards as parts of the national press teamed up with the Roman Catholic church and Brian Souter, a wealthy Scottish businessman, to fight the repeal. But in the end, they lost.
“It was the last gasp of conservative Scotland,” said David Torrance, an author and journalist, who is a respected political commentator and also gay.
Since then, Scotland has legalized civil partnerships, gay adoption and, in 2014,same-sex marriage (known in Scotland as “equal marriage” because it allows for entirely gender-neutral ceremonies). Scottish hate-crime law, which explicitly includes prejudice against transgender and intersex people, is considered one of the most robust in the world. And now the government is considering changing its gender recognition law to accommodate those with a “nonbinary” identity, which is neither female nor male.
“It’s extraordinary: We have started a conversation about a genderless society,” said Bob Orr, 66, who in 1982 co-opened Edinburgh’s first lesbian and gay bookshop, Lavender Menace.
That bookshop closed years ago, as have several gay bars. Gay people increasingly go to mainstream places, Mr. Orr said, and several singers in his “L.G.B.T. choir” are straight.
“The boundaries are going,” he said. “And that was always the point — that sexuality ceases to matter.”
Indeed, one of Scotland’s most prominent gay rights campaigners is straight: Liam Stevenson, a 38-year-old truck driver with a shaved head and soccer tattoo, led this year’s Pride Parade in Glasgow for Time for Inclusive Education, a campaign for L.G.B.T.-inclusive education that he founded with a gay student.
When their Parliament was created, 48 percent of Scots thought same-sex relationships were always or mostly wrong, according to the government’s social attitudes survey. That share dropped to 18 percent in the most recent survey, published this month.
When Scotland hosted the Commonwealth Games in 2014, the opening ceremony featured the Scottish-American actor John Barrowman kissing a male dancer. This “tartan kiss” was “Scotland telling the world who we are,” Mr. Torrance said.
And the world is beginning to take note. Andrew Brown, a gay wedding planner in Glasgow, said more gay couples from abroad were coming to Scotland to get married.
It helps that the paperwork is so simple: “Scotland is a bit like Vegas,” said Mr. Brown, who has recently organized weddings for Chinese, Italian and Canadian couples. A few years ago, he and his husband, Scott, were considering moving to Sydney, Australia. But they have decided to stay.
Val McDermid, a Scottish crime writer, moved to England in 1979, when, she said, in Scotland “just meeting other lesbians took more planning and luck than climbing Ben Nevis,” Scotland’s highest mountain. She returned two years ago.
“The country that I have come back to is not the country I left,” Ms. McDermidwrote this year. “This is now a place where you can be glad to be gay because it’s O.K. to be gay.”
By KATRIN BENNHOLD