Pop star Katy Perry caused a packed courtroom to burst into laughter when she said she could perform the hit song she is accused of stealing live after a technical glitch prevented a recording of it being played.

Perry, 34, is accused of copying the beat in her 2013 hit Dark Horse from a trio of American Christian rappers.

At court in downtown Los Angeles, Katy sat just two seats away from controversial co-defendant Dr Luke, her long-time co-writer who the star denied in court documents had raped her.

Pop star Kesha has claimed in a text to Lady Gaga that Dr Luke raped Perry. Kesha also accuses Dr Luke of rape and bullying - claims he denies - and the pair are embroiled in a long-running legal dispute.

Perry and Dr Luke, along with four others, are being sued by rappers Flame and D.A. Truth, plus song creator Chike Ojukwu, who claim their 2007 track Joyful Noise has the same intro as Katy's song.

Katy Perry is seen leaving court after defending her song 'Dark Horse' in a copyright infringement lawsuit from artist Marcus Gray and two other Christian rappers

The singer, dressed in a mint suit, made the court laugh after she joked she'd perform the disputed song live after a technical problem meant a recording couldn't be played

Giving evidence for 25 minutes Perry denied the claim, saying said she had never heard of the rappers or their song.

When a tech fault prevented her own song being played, she triggered laughs in the packed court room saying: 'I could perform it for you live.'

Perry, who was not accompanied to court by British boyfriend Orlando Bloom, also insisted that she and her co-writers had not found the rappers' song online.

She triggered more laughs when she added that when she was writing the song, which featured on the album Prism, at a studio in Santa Barbara 'a form of entertainment would be to go on YouTube and watch videos of cats and drink white wine as a break for our ears.'

She also talked about performing the song at the Super Bowl in 2015, which she described as 'touching the sky' in terms of prestige.

But she also added that because of the pressure to perform at her absolute peak during the halftime show, 'I don't wish it on anyone.'

She also said that she has never cancelled any live performance she was due at, including the 161 shows in her 2014-2105 Prism world tour which featured her performing Dark Horse.

Giving evidence for 25 minutes the singer (pictured arriving at court) denied the claim, saying said she had never heard of the rappers or their song

The singer looked relaxed as she arrived at court (pictured) and looked equally at ease after leaving

The suit alleges that the intro to Perry's 2013 smash hit Dark Horse (music video pictured) was stolen

Katy Perry is seen in these courtroom sketches in Los Angeles Federal Court, wearing a mint suit

Rappers Flame and D.A. Truth, plus song creator Chike Ojukwu, claim their 2007 track Joyful Noise has the same intro as Katy Perry's song

'I never cancelled a show and I am very proud of it,' she said.

Talking about her aims as a songwriter from when she first started performing aged nine, she said: 'My goal has always been to be a messenger of vulnerability, honesty and truth.'

She also discussed making a Christian pop LP as Katy Hudson in 2001 but it only sold between 200 and 300 copies, she said.

Perry, whose parents are pastors, then stopped performing Christian music as she split from her label and started listening to what she described as 'secular music.'

Dr Luke and producer Cirkut are said to have produced the beat which is said to be the same as the rappers' track.

Perry said that when Dr Luke and Cirkut played it to her, she wanted to make a song from it because 'the kind of dark feeling' she got from it appealed to her.

The star wrote the lyrics along with songwriter Sarah Hudson, no relation to the singer whose real surname is Hudson.

Sarah Hudson and Cirkut, real name Henry Walter, sat between Katy and Dr Luke, real name Lukasz Gottwald, in the courtroom.

Katy Perry arriving for dinner, rocking a navy vinyl trench coat after her day in court earlier

Perry leaves the restaurant with a friend after defending her song Dark Horse at court

They all listened intently as Katy described their song as a 'moody metaphor like the Trojan horse and the power of a woman and not to cross a woman because that karma is not good for you.'

Katy's deposition from March this year when she talked about her song was also read out.

In it, she makes the surprising admission: 'I don't read music.'

Attorney Mike Conn, representing the rappers, said their song Joyful Noise appeared on a Grammy-nominated album, Our World Redeemed and became a high-profile song more than a decade ago.

He told the jury: 'We're here to prove to you that the beat in Dark Horse infringes on the plaintiffs' copyright. The defendants took this part of the song without permission.'

The trial at Downtown LA's district court is expected to last two weeks.