The capability of the Automatic Identification System (AIS) to provide real-time worldwide coverage of ship tracks has made it possible for maritime authorities to utilize AIS as a means of surveillance to identify anomalies. Anomaly detection in maritime traffic is crucial as anomalous behavior may be a sign of either emergencies or illegal activities. Anomalous ships are recognized based on their behavior by manual examination. Such work requires extensive effort, especially for nationwide surveillance. To deal with this, researchers proposed computational methods to analyze vessel behavior. However, most approaches are region-dependent and require a profile of normality to detect anomalies, and amongst the six types of anomaly, loitering is the least explored. Loitering is not necessarily anomalous behavior as it is common for certain types of ships, such as pilot boats and research vessels. However, tankers and cargo ships normally do not engage in loitering. Based on 12-month manually examined data, nearly 60% of the identified anomalies were loitering, particularly for those of types cargo and tanker. Although manual identification is inefficient, automatically identifying abnormal vessels by merely implementing computing algorithms is not yet feasible. It still needs subject matter experts' assessments. This study proposes a region-independent method to automatically detect loitering without training normal instances and produces a ranked list of loitering vessels to facilitate further anomaly investigation. First, the loitering spatiotemporal characteristics are defined: (1) movement of frequent course change, with a certain speed, within a certain spatial range, (2) movement of frequent course change within traversed geodetic distance, (3) might demonstrate frequent extreme turning, and (4) extreme turning produces a significant discrepancy between the course over ground and the heading of the ship. Then, the characteristics are quantified by manipulating the dynamic information of AIS messages. Finally, the parameters to determine a loitering trajectory are formulated by comparing the rate of course change, speed, and the discrepancy between heading and course with the area of spatial range enclosing the trajectory and the geodetic distance between the start and end point. The loitering score of each trajectory is calculated with the parameters, and the Isolation Forest algorithm is employed to establish a threshold and rank. Then, geographic visualization is created for intuitive evaluation. An experiment was conducted on a real-world dataset covering a sea area of 610,116.37 km2. The results prove the efficacy of the proposed method. It remarkably outperforms the existing approach with 97% accuracy and 92% F-score. The experiment produces a ranked list of loitering vessels and an intuitive visualization in the relevant geographic area. In the realworld scenario, they are practical means to support further examination by human operators.