A social experiment that ended with an actor posing as an Islamophobe getting punched in the face has shown that Canadians are prepared to defend Muslims in the face of overt racist abuse in the wake of a recent terror attack.

In an attempt to test whether Canadians feel safe in the presence of Muslims following the fatal shooting of Corporal Nathan Cirillo by an Islamic extremist last week, director Omar Al-Bach conducted the experiment in Cirillo's home town of Hamilton to see how many people would defend a supposed Muslim from verbal abuse.

At the start of the video, Al-Bach introduces two actors, "Devin" as an outspoken racist and "Zack" dressed in a traditional Islamic kaftan with a white cap.

The video shows members of the public standing up for the victim – with one even prepared to punch the racist in the face after Devin accuses Zack of being a potential terrorist because of the way he looks.

Since it was uploaded 24 hours ago, the video has garnered nearly 300,000 views and the filmmakers went on Canadian channel Global TV yesterday to talk about their social experiment.

The film begins with the two actors standing outside a bus stop.

"Are you planning on taking a bus? I suggest you take another ride," Devin tells one bystander in the video.

"What happened there [in Ottawa] was an incident of fanatics. Everybody cannot be punished like that," he adds before becoming so concerned for Zack's safety that he pretends to be his friend.

"I'm sorry, but this is a friend of mine. I'm with him too," he says, adding "true Muslims do not believe in that sh*t, it's fanatics, it's crazy people."

"But he could be armed with explosives," argues Devin, to which the man exclaims "so could I!" And when Devin tries to escort Zack away from the bus stop, the travellers ask him to leave instead and warn they will call the police.

In another scene, a woman hits back at Devin and argues while Corporal Cirillo's death was tragic "I don't think that's any reason to persecute someone just because of what they're wearing."

When Devin accuses Zack of "looking like a terrorist," the woman shouts "f*** you man, what the hell?! Why would you call him a terrorist just because he's dressed like that?"

The film culminates in Devin receiving a swift punch to the face after telling Zack to move away from a nearby building as he "believed" he had explosives strapped to him.

Another man who was defending Zack against Devin's inflammatory comments says: "Get the **** out of here bud. You're going to get ****** up."

The actor then shouts "it's a social experiment!" to ward of his attackers.

Devin addresses the camera at the end, with blood running down his face from his nose, to say that he "appreciates" that various members of the public stood up for Zack even though he got assaulted in the process.

Al-Bach ends the film with a tribute to 24-year-old Cirillo.