Nonlocal self-similarity is an important property of Synthetic Aperture Radar (SAR) images to characterize the repetitiveness of features embodied by SAR images within nonlocal areas and has been used for enhancement of SAR images. Existing SAR ship detectors often independently handle small sub-images cropped from a large marine SAR image and do not exploit the nonlocal self-similarity therein. In this paper, we propose a new ship detector from the perspective of nonlocal self-similarity in SAR images to improve the ship detection performance, basically including three stages: prescreening, intra-cue calculation, and inter-cue calculation. In the pre-screening stage, we design a new Histogram-based Density (HD) feature to rapidly select candidate sub-images potentially containing ship targets from a large SAR image. In the intra-cue calculation stage, target cues within a single candidate sub-image are extracted. In the inter-cue calculation stage, thanks to the nonlocal self-similarity among different candidate sub-images in terms of density features, we innovatively extract a weighted superpixel-HD map to obtain accumulated intra-cues across all the candidate sub-images. Finally, for each candidate sub-image, we fuse its inter-cue and intra-cue to obtain final detection results. Experimental results based on real SAR images show that our newly proposed method provides a better target-to-clutter contrast and ship detection performance than those of other state-of-the-art detection approaches.