A man dressed in a secret-agent costume was arrested in Victoria, B.C., Sunday night after he was spotted carrying what police thought was a gun.

The 35-year-old was leaving a costume party at a nightclub near Johnson and Wharf streets around 9 p.m. when a passerby spotted the man with what looked like a 9-mm pistol in a holster.

The witness called Victoria police with a description and the man was arrested and taken into custody at police headquarters.

Sgt. Colin Watson told ctvbc.ca that once the gun was removed from its holster police realized it was a fake plastic toy that looked quite real.

"Charges weren't necessary and he was released with a warning," Watson said.

Police are encouraging people not to carry real or imitation weapons when wearing a costume. Watson said it is time-consuming for police who have to investigate all firearms complaints from the public.

"In light of recent shootings in Vancouver, public awareness has increased and people are paying more attention to their surroundings."

Watson said the man did not appear to be intoxicated and was compliant and cooperative throughout the investigation.

"We expect this type of thing during Halloween, but not at the end of August. The man should know better."