Individuals with autism spectrum disorder (ASD) have a greater prevalence of deficits in social interactions and repetitive behaviours, which are influenced by hereditary and environmental factors. How environmental factors influence genetically predisposed individuals remains unknown. Here, we provide new evidence of the interplay between social behaviour and environmental influences, by manipulating perceived safety and threat levels in ube3a mutant zebrafish, a mutation that is linked to Angelman syndrome and ASD. Mutant fish demonstrated abnormal social behaviour in an aversive custom-made Styrofoam container, whereas these abnormalities ameliorated in a preferred Plexiglass setting. Our findings were further supported by elevated anxiety levels in the mutants when they performed conventional anxiety-related tests, such as the light‒dark test (LDT) and the novel tank diving test (NTT). Additionally, neural activity mapping using c-Fos in situ hybridization revealed differences in activation patterns in the brains of the mutants. Importantly, we performed an overrepresentation analysis (ORA) using RNA sequencing data from ube3a mutants and integrating datasets from human diseases. We identified the upregulation of vision- and comorbidity-related genes in ube3a mutants and alterations in sensory pathways, highlighting that abnormal processing of visual information is the cause of increased anxiety levels, resulting in decreased social interaction in a stressful Styrofoam environment. Our findings underscore the crucial impact of environmental factors on social behaviour and indicate that therapeutic options for ASD that focus on adjusting environmental contexts to modify perceived stimuli may ameliorate ASD-like behaviours.