Image copyright Getty Images Image caption The 65-year-old comedian apologises for tweets about Chelsea Clinton and an aide to President Obama

Comedian Roseanne Barr has apologised for a tweet comparing ex-Obama adviser Valerie Jarrett, who is African American, to an ape.

She sparked an online backlash after she called Mrs Jarrett the child of the Islamist group the Muslim Brotherhood and the Planet of the Apes film.

She deleted the racist post and apologised amid criticism of her and the ABC network, which airs her show.

Mrs Jarrett was born in Iran to American parents.

"I apologise to Valerie Jarrett and to all Americans," the star of ABC's Roseanne wrote, after follow-up posts in which she defended her remarks as a "joke".

"I am truly sorry for making a bad joke about her politics and her looks. I should have known better. Forgive me-my joke was in bad taste."

Her post came in response to another Twitter user, who accused Mrs Jarrett of helping to conceal spying during the Obama administration.

Mrs Jarrett will be contributing to a town hall discussion on MSNBC on Tuesday on the subject of "everyday racism".

Barr also wrote on Tuesday that she was "now leaving Twitter", but it was unclear if that meant she would deactivate her account.

Ten days ago, she pledged that she was "leaving all social media except Instagram", saying it was because the atmosphere had become "toxic".

Will the ABC sitcom survive?

James Cook, BBC News, Los Angeles

Roseanne Barr's late night Twitter tirade was vitriolic. The actor described the former Obama adviser Valerie Jarrett, who is African American, as the offspring of a union between the Muslim Brotherhood and Planet of the Apes.

Using foul language, she attacked Hillary Clinton and her daughter Chelsea and called the billionaire investor George Soros, who is Jewish, a Nazi.

She also tweeted support for the far-right English politician Tommy Robinson. Barr apologised for the racist tweet saying it was a joke. The comedian Wanda Sykes, who is a producer on the show Roseanne, says she will not return to the sitcom.

Other critics have demanded that ABC suspend or scrap the programme, which has been praised for tackling America's political division in a manner sympathetic to the millions of people who voted for Donald Trump.

ABC has yet to comment on her statements.

Consulting producer of the television show and fellow comedian Wanda Sykes tweeted later in the day that she "will not be returning" to the programme.

Actress Sara Gilbert, who played Barr's daughter on the original series and reprised her role for the reboot, tweeted that Bar's comments "are abhorrent and do not reflect the beliefs of our cast and crew".

"I am disappointed in her actions to say the least."

Earlier on Tuesday, Barr tweeted an apology to Chelsea Clinton - the daughter of former US President Bill Clinton and Hillary Clinton - after claiming she was married to a relative of billionaire investor George Soros.

"Sorry to have tweeted incorrect info about you! Please forgive me," she wrote to Chelsea Clinton.

On Sunday, the 65-year-old comedian also criticised the Obama family for signing on with Netflix to produce TV programmes and movies.

"I don't think any President should go from WH to producing big media 4 public consumption."

Image copyright Getty Images Image caption Mrs Jarrett, centre, was one of Mr Obama's longest-serving aides

"It's an unholy alliance. Leave show biz 2 professionals," she wrote, adding that "going from show biz 2 WH is OK".

Roseanne's reboot of her popular comedy series has sparked controversy as well as strong ratings, after it was revealed that she portrays a supporter of US President Donald Trump.

President Trump, who she also supports off-camera as well - called her to congratulate her on the success of the revival of her television programme.

Actors Don Cheadle and Patricia Arquette were among those who took to Twitter to condemn Barr's tweets.