Will & Grace star Eric McCormack thanked the LGBTQ community as he was honoured with a star on the Hollywood Walk of Fame.

The sitcom centres on the friendship between McCormack’s Will Truman, a gay lawyer, and Debra Messing’s Grace Adler, a straight interior designer.

Will & Grace began in 1998 before being revived last year and has been credited with helping to improve public opinion of the LGBTQ community.

On Thursday McCormack, who is straight, was honoured with star number 2,644 on the Walk of Fame for his contribution to television.

Eric McCormack Honored with a Star on the Hollywood Walk of Fame
Eric McCormack was honoured with a star on the Hollywood Walk of Fame (Willy Sanjuan/Invision/AP)

The 55-year-old Canadian said he would be grateful to the LGBTQ community “for the rest of my life” for accepting him in the role.

He said: “The only reason I am here today is because 20 years ago Max Mutchnick and David Kohan (the creators of Will & Grace) trusted me with the role of a lifetime. NBC trusted me.

“And eventually a whole community, the LGBTQ community, trusted me with their story and I am so grateful for the rest of my life.”

He then paid tribute to his co-stars Megan Mullally and Sean Hayes, who were watching on, as well as Messing, whose own star is just yards away from his.

McCormack, who won an Emmy for his role as Will, then paid tribute to his wife, Janet Holden.

Eric McCormack Honored with a Star on the Hollywood Walk of Fame
With co-stars, from left, Megan Mullally, Eric McCormack, Debra Messing and Sean Hayes (Willy Sanjuan/Invision/AP)

He said: “Next year will be our 25th year together and make no mistake, I would not be here on this podium in front of this star without her overwhelming belief in me and in us and in the future.

“This is a tribute to our journey from the moment we met, through to Los Angeles, through to this day. This is ours.”

Michael Douglas had a guest role in Will & Grace in 2002 and played a gay detective who is attracted to McCormack’s character.

Douglas, 73, introduced McCormack at Wednesday’s ceremony and said the pair had been in “perfect sync” during filming.

He told the crowd he had danced seductively behind McCormack for the episode, saying it was the “gayest thing I have ever done – and I played Liberace”.

Douglas added: “Over the course of that week I came to know a real pro. A man of the theatre, and a gifted comedian who came to this town with a knowledge of, and respect for, those who had come before him.

“My friends Sydney Pollack, Blythe Danner and Gene Wilder and so many others came away from that experience with a love and appreciation of Eric and I know that’s something that means a lot to him.”

Will & Grace season 10 is due to air on October 4 in the US.