A gay Democrat living with HIV has been elected as the new Speaker of New York City council.

Corey Johnson was elected to the role this week in a near-unanimous vote of the 50 city councillors.

Mr Johnson replaces the outgoing Speaker Melissa Mark-Viverito.

The new Speaker Johnson previously made history as the only openly HIV-positive politician in the State of New York, and has also pioneered LGBT rights.

Mr Johnson made national headlines as a teenager in 2000 when, as captain of his high school football team at Masconomet Regional High School, he came out as gay.

Aged just 17 at the time, Mr Johnson was featured in the New York Times and on 20/20 to talk about his life and LGBT rights. He later became a contributor for gay blog Towleroad.

He joined the New York City council representing the 3rd District in 2014, and has fought on issues including homelessness, criminal justice, health and women’s rights.

His confirmation as Speaker follows a tough race, but his nomination was approved by 48 votes to 1 – with council member Inez Barron the lone dissenter, lamenting the lack of African-American candidates.

Taking up the role, Mr Johnson noted the body’s role in LGBT rights reforms previously.

He said: “If we become unmoored and lose our way, we need only listen to the voices of those we represent to correct our course.

“At this time, 32 years ago, in this very chamber, the city council considered legislation that would finally outlaw discrimination on the basis of sexual orientation in housing, employment and public accomodations.

“As the AIDS epidemic was ravaging the gay community, supporters and opponents of the bill engaged in a long and bitter fight in this very chamber. Opponents said the bill would lead to societal acceptance of the LGBT community. And guess what? They were right.

“Let us continue to take on the important issues that may be considered controversial today but will be indesputable tomorrow. Let us continue to use the power of this body to be the voice for the voiceless.”

“I am incredibly honoured by the confidence you have placed in me.”

He also opened up about his childhood.

He said: “When I came out at 16 years old, I was suicidal, despondent and didn’t want to live.

“I told my mother that I was gay, and she told me that she loved me, unconditionally, without hesitating.

“A few months later, [I told] my grandfather. He was an 82-year-old Irish Catholic who went to Mass every single day.

“I said, ‘Grandpa, I have something to tell you.’ He said, ‘you’re killing me, spit it out!’. I said, ‘I told mum and dad that I’m gay’.

“He said, ‘Jesus, Mary and Joseph, I thought you were going to tell me you were a Republican! You can be gay, you just have to be a Democrat.’

“Grandpa, I’ve lived up to that end of the bargain – I’m gay and I’m a Democrat.

“Each one of us in this body has a story like that, no matter where we came from or what our life experience is. That’s the great thing about our city – it’s the most diverse city in the world.”

His fellow council member also paid tribute to Mr Johnson.

Council member Ritchie Torres said: “I first heard the name Corey Johnson 18 years ago. It was the year 2000, I was 12 years old, and I stumbled upon a documentary featuring a young Corey Johnson who as captain of his high school football team, found the courage to come out publicly in a conservative small town.

“He did so in a place where coming out could have meant painful ostracism from the only community he had ever known. I remember listening intently to Corey’s story as an adolescent coming to terms with my own identity.

“I remember being inspired then by his courage. Never once in those years did I imagine serving under the leadership of the very trailblazer whose story inspired me nearly two decades ago – but here we are, on the verge of elevating Corey Johnson to the Speakership of the Council.”

Delivering an invocation, Bishop Sylveta Hamilton-Gonzales of Q-Kingdom Ministries in Brooklyn said: “Eternal and ever-wise true and living god, our father and our mother, today we celebrate this pivotal moment in the history of our city with the election of Cory Johnson, our first gay male Speaker of the City of New York Council.

“Council member Johnson provides a crucial representation of courage, confidence and success in his leadership role for our transgender youth and for those that are struggling under pervasive challenges of oppression and rejection.”