The new film Peter Rabbit is facing a boycott over a scene in which he and his friends hurl blackberries at a character knowing he is allergic to them.
The scene has prompted a furious backlash with some people accusing the filmmakers of creating a movie that "encourages food allergy bullying".
The filmmakers and the studio, Sony Pictures, have apologised following the outcry over the scene in which Mr McGregor's nephew Thomas is forced to use an EpiPen as a result of the attack.
It comes after the charity group Kids with Food Allergies posted a warning about the scene on social media and said it had written a letter to the filmmakers.
It wrote in a Facebook post: "It is unnecessary for a film to show the characters intentionally attacking another with his food allergen to trigger anaphylaxis.
"Portraying anaphylaxis as a joke can cause some people to have a cavalier attitude about food allergies which can put kids with food allergies at risk.
"We are asking filmmakers to work with us to raise awareness about the seriousness of food allergies, and help us promote positive attitudes and safe environments for kids with food allergies."
So you think bullying a person with food allergies is OK?!? My daughter nearly died from one of her food allergies. We are proud to #boycottpeterrabbit due to the insensitivity portrayed. 1 out of every 13 kids in the US live with life threatening food allergies @SonyPictures
— Quakes-JD (@JDMcCall1) February 12, 2018
This is pretty awful. And I don’t have allergies or kids. None needed to see the insensitivity. #boycottpeterrabbit
— MaureenC (@PaMaureen) February 12, 2018
@SonyPictures you are deplorable #boycottpeterrabbit My 2 kids have horrible allergies & u make a joke of it. Not seeing this or any of your movies ever. Honestly not even sure what u were thinking making this scene.
— LGLfla (@Lgl1853) February 12, 2018
The controversy triggered a mixed reaction and the hashtag #boycottpeterrabbit on social media, with some people describing the scene as "insensitive", and others as "funny".
One parent wrote: "@SonyPictures you are deplorable #boycottpeterrabbit My 2 kids have horrible allergies & u make a joke of it. Not seeing this or any of your movies ever. Honestly not even sure what u were thinking making this scene."
Another wrote: "This is pretty awful. And I don't have allergies or kids. None needed to see the insensitivity. #boycottpeterrabbit."
One woman posted an image of her daughter crying in a bed and wrote: "This is what an anaphylactic reaction looks like in a child. This is AFTER epinephrine and Benadryl. It's NOT a punchline to a joke. #boycottpeterrabbit."
However, others didn't understand what the fuss was about.
#boycottpeterrabbit is the most ridiculous thing I've seen today and it's 07:17am. I understand where they're coming from but
1) it's a film
2) the entire film is literally a man setting up inhumane traps to harm rabbits forcing them out of home
3) cartoons have done far worse
— Sophie Dolan (@TechieDolan) February 12, 2018
— Doug (@Dugpic) February 12, 2018
One person wrote: "I'm allergic to some foods as well, but this is funny. Quit whining about everything. #boycottpeterrabbit #crybabies."
Another said: "This is officially crazy. I'm going to #boycottpeterrabbit not because of the scene in question, but because they apologised for it. #JustAMoviePeople."
Kenneth Mendez, the president and CEO of the Asthma and Allergy Foundation of America, also wrote an open letter to the studio urging it to "examine your portrayal of bullying in your films geared toward a young audience".
The studio and filmmakers said that they "sincerely regret not being more aware and sensitive to this issue, and we truly apologise".
More from Entertainment
The controversial scene is in a film adaptation of Peter Rabbit, the much-loved Beatrix Potter character, which was released in US cinemas at the weekend.
The movie, starring James Corden who voices the character of Peter, will hit the big screen in the UK on 16 March.