John Boyega has responded to racism after the first teaser for Star Wars: The Force Awakens was posted online.

The British actor, who appears in the clip dressed as a stormtrooper, told critics of his casting to “get used to it” on Instagram.

In the message he also thanked fans “for all the love and support” after the teaser was posted online.

His comments followed some questioning director JJ Abrams for casting a black actor in a seemingly prominent role.

One YouTube comment suggested the film “didn’t need some black Jedi”.

Another read: “Dear Black People, We are forced to include you into everything awesome we do.”

The official trailer has been viewed nearly 10m times since being put online on Friday.

Boyega, who has previously appeared in Attack the Block and 24, said: “A year is a long time to wait, but it will be worth it.”

Billy Dee Williams and Samuel L Jackson are among the black actors to appear in previous Star Wars films

Other Star Wars fans were quick to remind critics of Boyega’s casting of other black actors who have featured in the franchise.

Samuel L Jackson played Mace Windu in Episode I The Phantom Menace and again in Clone Wars, while Billy Dee Williams appeared as Lando Calrissian in The Empire Strikes Back and Return of the Jedi.

Stormtrooper analysis

Many fans have pointed out that there is no reason to believe stormtroopers couldn’t be black.

In the prequels – and let’s be honest Star Wars fans do not accept the prequels – Obi-Wan Kenobi travels to the planet of Kamino, where he discovers the existence of a clone army that would feed the so-called Clone Wars. But those clones weren’t necessarily white.

Bounty hunter Jango Fett, who served as the genetic template, was an ethnic “Mandalorian”. He was played by New Zealand-born actor Temuera Morrison, of partial Maori descent.

But even if he had chosen to pass himself off as white, Boyega’s “black stormtrooper” character would’ve existed in a time when stormtroopers were more than likely recruited rather than created from the general population.

Therefore stormtroopers could probably be of any race.

Also let’s remember that the events of Episode 7 take place more than 50 years after the Clone Wars. It may well be that the Empire, or what’s left of it, has changed its stormtrooper recruitment policy (perhaps as a result of having had its stormtrooper-defended Death Stars blow up a couple of times.)

It should also be pointed out Boyega may not even be a stormtrooper – he could be a rebel in a stormtrooper uniform, like Han Solo and Luke Skywalker in Star Wars Episode IV: A New Hope.