Representing maritime traffic patterns and detecting anomalies from them are key to vessel monitoring and maritime situational awareness. We propose a novel approach-referred to as GeoTrackNet-for maritime anomaly detection from AIS data streams. Our model exploits state-of-the-art neural network schemes to learn a probabilistic representation of AIS tracks, then uses a contrario detection to detect abnormal events. The neural network helps us capture complex and heterogeneous patterns in vessels' behaviors, while the a contrario detection takes into account the fact that the learned distribution may be location-dependent. Experiments on a real AIS dataset comprising more than 4.2 million AIS messages demonstrate the relevance of the proposed method. Keywords: AIS, maritime surveillance, deep learning, anomaly detection, variational recurrent neural networks, a contrario detection.