(CNN) -- Roseanne Barr blamed the sleep aid Ambien for a series of racist tweets that resulted in the cancellation of her show "Roseanne" by ABC on Tuesday.

Barr tweeted, "guys I did something unforgiveable so do not defend me. It was 2 in the morning and I was ambien tweeting."

In another tweet, Barr doubled down, saying that she has "done weird stuff while on ambien-cracked eggs on the wall at 2am etc --"

    Ashleigh Koss, a spokeswoman for the North America region of Sanofi, the maker of Ambien, said in a written statement Wednesday, "While all pharmaceutical treatments have side effects, racism is not a known side effect of any Sanofi medication."

    The claim drew questions and backlash from social media, with one writer and correspondent for the TV show "Full Frontal with Samantha Bee" saying, "Ambien makes you racist? No wonder some of y'all can't get woke."

    A number of celebrities have claimed that Ambien contributed to their odd behavior, including John Stamos and Charlie Sheen, who tweeted, "adios Roseanne! good riddance. hashtag NOT Winning."

    The drug has also been a controversial defense in many legal cases.

    In 2010, a man accused of disrupting a trans-Atlantic flight by claiming he was carrying explosives also told the federal marshal onboard that he had taken Ambien, according to court documents. Doctors said at the time that it was very unlikely that the drug was the cause.

    "In a person experiencing confusional arousal because of Ambien, you wouldn't expect to hear comments from that person that seem to fit into the context of the environment that they are in," said Dr. Michel Cramer Bornemann, a lead investigator of Sleep Forensics Associates. "In this case, a man on board a plane is talking about false passports, bombs, dynamite and blowing up a plane. This seems really at first glance, inconsistent with what we know of Ambien's side effects."

    Ambien, also known by the generic name zolpidem, is a prescription drug used to treat insomnia that was approved in 1992 by the US Food and Drug Administration. It belongs to a class of medications called sedative-hypnotics.

    The drug has a number of side effects including "abnormal thinking and behavioral changes," which may take the form of "decreased inhibition" such as aggressiveness and extroversion that seem "out of character," according to information that comes with the drug. Hallucinations have also been reported, representing less than 1% of adults in controlled trials for insomnia.

    Researchers have found high levels of zolpidem in the blood of some patients the morning after a dose -- so much so, it could affect their cognitive and driving skills. This prompted the FDA to lower recommended dosages for certain people in 2013.

    There have been reports of "complex behaviors": cooking and eating food, making phone calls, having sex and driving. The risk of these behaviors may increase at higher doses and in combination with alcohol or other drugs.

    These behaviors "have been reported in patients who are not fully awake after taking a sedative-hypnotic," drug information documents say. "Patients usually do not remember these events.

    "It can rarely be determined with certainty whether a particular instance of the abnormal behaviors listed above is drug induced, spontaneous in origin, or a result of an underlying psychiatric or physical disorder. Nonetheless, the emergence of any new behavioral sign or symptom of concern requires careful and immediate evaluation."

    Barr's Tuesday tweet, in which she said that Valerie Jarrett, a former aide to President Obama, was the "baby" of the "Muslim brotherhood & planet of the apes," was not viewed as a one-off. Critics say she's made objectionable comments and spread conspiracy theories before, including a fringe theory about how Trump has "freed so many children held in bondage to pimps all over this world."

    Copyright 2018 CNN. All rights reserved.