James Corden apologises to Ricky Gervais for 'inadvertently' telling his joke

Watch: James Corden responds to accusation he stole joke from Ricky Gervais

James Corden has apologised to Ricky Gervais for accidentally using his joke without giving him credit.

The Office creator called out the Gavin And Stacey star for retelling a joke about Twitter from one of his stand up shows on The Late Late Show "word for word".

Corden, 44, has now responded: "Inadvertently told a brilliant Ricky Gervais joke on the show last night, obviously not knowing it came from him. It’s brilliant, because it’s a Ricky Gervais joke. You can watch all Ricky’s excellent specials on Netflix. Jx"

Read more: James Corden branded a 'phony' by NY restaurant owner over 'fraudulent' apology

Gervais, 61, has deleted his original tweet and shared Corden's apology.

Discussing Corden's "embarrassing" apology on her ITV show, Lorraine Kelly observed: "Oh dear, does he have maybe writers that don't like him?... I can imagine, that is very extraordinary!"

The After Life star had shared a clip from The Late Late Show in which Corden gets laughs and applause for a joke about angry social media users that is directly repeated from a well-known part of Gervais' own stand up comedy routine.

James Corden, Ricky Gervais
James Corden has apologised for 'inadvertently' using Ricky Gervais's joke without permission. (CBS/Getty)

Gervais captioned it: "The bit about the town square advert for guitar lessons is brilliant."

In the show's monologue, Corden is talking about Elon Musk taking over Twitter and how the social media platform often sees users being angry and posting about being offended on any issue.

He says: "That's what I think when you see Elon Musk talk about Twitter, he says, 'well it's the town square', but it isn't.

Actor/comedian Ricky Gervais speaks on stage during the 66th Annual Primetime Emmy Awards held at the Nokia Theater on August 25, 2014.  (Photo by Mark Davis/NBC/NBCUniversal via Getty Images)
Ricky Gervais originally made the joke in his stand-up routine. (Getty Images)

"Because if someone puts up a poster in a town square that says guitar lessons available, you don't get people in the town square saying, 'I don't want to play the guitar! I want to play the piano, you piece of s***!'

"Well that sign wasn't for you, it was for somebody else, you don't have to get mad about all of it."

The joke is exactly the same as one that Gervais, a frequent Twitter user, has already told in one of his stand up routines, with many of his fans sharing the original clip.

James Corden
James Corden retold the joke on The Late Late Show. (CBS/Getty Images)

In response to a fan asking whether Corden had asked to use the joke, Gervais replied: "No. I reckon one of the writers 'came up with it' for him. I doubt he would knowingly just copy such a famous stand up routine word for word like that."

Read more: James Corden admits he 'behaved like a brat' when he first became famous

Corden recently came under fire from the owner of New York restaurant Balthazar, who accused him of being rude to staff — something the star apologised for on The Late Late Show last week.