James Corden Credits Ricky Gervais After He 'Inadvertently' Told the Comedian's Joke

James Corden, Ricky Gervais
James Corden, Ricky Gervais

Taylor Hill/Getty; Nicholas Hunt/Getty

James Corden is denying that he intentionally stole a joke from Ricky Gervais.

Following Monday's episode of The Late Late Show, viewers noticed when Corden, 44, told a nearly-identical joke to one that the British comedian, 61, shared in his 2018 Netflix special, Ricky Gervais: Humanity.

While discussing new Twitter owner Elon Musk calling the social media platform a "town square," the television personality joked: "But it isn't, because if someone puts up a poster in a town square that says 'guitar lessons available,' you don't get people in the town [who] go, 'I don't want to play the guitar! I want to play the piano!'"

He continued, "Well, then that sign wasn't for you. It was for somebody else! You don't have to get mad about all of it."

RELATED: James Corden Says It Was 'Never My Intention' to Upset Restaurant Staff, Vows to Apologize in Person

The segment went viral after viewers pointed out the similarities between Corden's joke and the one Gervais previously made.

"It's like going into a town square," Gervais joked in 2018, per CNN. "And there's a notice for guitar lessons and you go, 'But I don't f---ing want guitar lessons.'"

Ricky Gervais
Ricky Gervais

Andrew H. Walker/Getty Ricky Gervais

RELATED: James Corden Shares How His Family Impacted Decision to Leave Talk Show: 'The Right Time for Us'

Gervais appeared to be taking the incident in stride when he responded to a Twitter user who asked if Corden received permission to use the joke.

"No. I reckon one of the writers 'came up with it' for him," Gervais tweeted. "I doubt he would knowingly just copy such a famous stand up routine word for word like that."

Following the social media outcry, Corden gave credit to Gervais for the joke.

"Inadvertently told a brilliant Ricky Gervais joke on the show last night, obviously not knowing it came from him," Corden wrote in a tweet on Tuesday. "It's brilliant, because it's a Ricky Gervais joke. You can watch all Ricky's excellent specials on Netflix."

Before the joke scandal, Corden came under fire after being banned from the popular NYC restaurant Balthazar. Keith McNally — who owns Balthazar in NYC — slammed Corden over his alleged behavior at the establishment and claimed the star was "the most abusive customer to my Balthazar servers."

RELATED: James Corden Reveals How Louis Tomlinson's Mom Helped Introduce Him to Friend Harry Styles

Corden privately apologized to McNally, 71, over a phone call, but he also addressed the matter on his long-running talk show.

He explained that his wife Julia Carey was given food she was "allergic" to. After the order came back wrong repeatedly, Corden chose to make a "sarcastic" comment.

"In the heat of the moment, I made a sarcastic rude comment about cooking it myself," he admitted. "It is a comment I deeply regret. I understand the difficulties of being a server. I worked shifts at restaurants for years."

Corden previously announced in April that he was leaving The Late Late Show. His tenure will conclude sometime next spring.

Never miss a story — sign up for PEOPLE's free daily newsletter to stay up-to-date on the best of what PEOPLE has to offer, from juicy celebrity news to compelling human interest stories.

The Late Late Show with James Corden airs weeknights (12:30 p.m. ET) on CBS.