The present invention provides a prophylactic or therapeutic agent for an autism spectrum disorder containing compound (I) having melatonin receptor affinity. A compound represented by the formula: wherein each symbol is as described in the specification, or a salt thereof.