Media playback is unsupported on your device Media caption Kezia Dugdale said she regretted not having "complete control" over coming out

Former Scottish Labour leader Kezia Dugdale says she had to come out as gay after being outed by a magazine.

The MSP says when she asked for her quotes on her sexuality not to be included in an interview with the Fabian Review, her request was ignored.

The Fabian Society said it was "very sorry" she was upset by the interview.

Meanwhile, Tory MP Sir Alan Duncan says his sexuality prevented him from getting a role in former Prime Minister Sir John Major's government.

They were among a number of politicians speaking to the BBC's Victoria Derbyshire programme about what it was like opening up about their sexuality.

Lothian MSP Ms Dugdale who resigned as the leader of Scottish Labour on Tuesday, said she regretted not having "complete control" over coming out after quotes about her sexuality had been published in 2016.

"It wasn't the first time I'd been asked [by journalists] about my sexuality. I would always answer honestly, and then I would say, 'I'd prefer you didn't use that... I don't think it matters.'

"Up until that day, everybody had respected that, and then that one journalist had decided no, it was a story," she said.

Image copyright Scottish Labour Image caption Ms Dugdale is in a relationship with SNP MSP Jenny Gilruth

Ms Dugdale said the night before publication she had decided to "make some phone calls" to inform people of her sexuality before it had been revealed in the media.

The Fabian Society said in a statement that the "wide-ranging and comprehensive on-the-record interview was conducted by an experienced, broadsheet journalist who followed usual journalistic practice".

The article's author, Mary Riddell, said "at no point during the interview or afterwards did [Ms Dugdale] ask me not to publish her comments, which were recorded with her agreement.

"Nor has she ever complained to me that her on-the-record comments relating to her relationship had been published."

Ms Dugdale is in a relationship with SNP MSP Jenny Gilruth.

The Labour politician said it was "fascinating" that public attention had focused on the couple's political divide, rather than their sexuality.

"People weren't in any way bothered that it was two women together.

"They were more intrigued it was two people from different political parties," she said, adding that this "definitely" showed how attitudes towards LGBT people had progressed.

'I'm just going to say it'

British voters returned a record number of LGBT MPs to Parliament in the last general election with 45 gay, lesbian or bi-sexual MPs elected in June - six more than in the previous parliament.

Sir Alan Duncan, Conservative MP and Foreign Office Minister, said he came out as gay in 2002.

"I thought, 'I'm just going to say it. Whatever happens, happens'."

"I'd reached the point, having been in Parliament for 10 years, where I thought I was senior enough not to be dismissed."

Media playback is unsupported on your device Media caption Sir Alan Duncan MP: My sexuality stopped a promotion

Sir Alan has continued to serve as an MP since that day, but believes his sexuality did cost him a role as a whip in Sir John Major's government.

"I know I was blackballed from the whip's office," he said.

"Not by him, but by [others], who thought it would be too high-risk."

Sir Alan did face some hostility after he revealed his sexuality, with one article's headline reading: "I'm sorry Mr Duncan. if you're gay you are not a Tory."

But, he said, by now, with a number of gay MPs in Parliament, the UK could lead the way on LGBT rights.

"The UK can campaign [with countries without gay rights] and say, 'How dare you live in a country where you persecute gay people.'"

SNP MP Joanna Cherry told the programme she had previously believed she would be unable to have a political career because of her sexuality.

"When I realised I was gay and I saw what happened to [former Labour Party candidate] Peter Tatchell in the [1983] Bermondsey by-election, the terrible homophobia that he faced... I thought to myself a career in politics isn't going to be open to me.

"So I chose instead to concentrate on my legal career."

But in 2015 Ms Cherry stood for office, and was elected.

She said "like most gay MPs", she had since received homophobic abuse on Twitter, but was "very proud to be out as a lesbian in politics".

"I hope to be a role-model to younger women who can see you can be an out woman in public life," she said.

In 1984 Lord Smith became the UK's first MP to come out as gay in office, and in 2005 spoke publicly about being HIV positive.

"Since then, I haven't regretted making that decision for a single moment," he told the Victoria Derbyshire programme.

It would be another 13 years until there was another openly gay MP - Labour's Stephen Twigg - and Lord Smith said he had initially been "terrified" of the reaction, but had received many positive letters.

"There was no social media in those days, thank goodness, but I did get letters from people from all around the country," he said.

"A lot of them saying, 'Well done, congratulations,' but the ones that really meant the most to me were the ones that said, 'Thank you, it's made it easier for me.'"

Watch the BBC's Victoria Derbyshire programme on weekdays between 09:00 and 11:00 on BBC Two and the BBC News channel.