Abstract. We present a method for learning characteristic motion patterns of mobile agents. The method works on two levels. On the first level, it uses the expectation-maximization algorithm to build a Gaussian mixture model of the spatial density of agents' movement. On the second level, agents' trajectories as expressed as sequences of the components of the mixture model; the sequences are subsequently used to train hidden Markov models. The trained hidden Markov models are then employed to determine agent type, predict further agent movement or detect anomalous agents. The method has been evaluated in the maritime domain using ship trajectory data generated by the AgentC maritime traffic simulation.