Regions of the ocean's thermocline unstable to salt fingering are often observed to host thermohaline staircases, stacks of deep well-mixed convective layers separated by thin stably-stratified interfaces. Decades after their discovery, however, their origin remains controversial. In this paper we use 3D direct numerical simulations to shed light on the problem. We study the evolution of an analogous double-diffusive system, starting from an initial statistically homogeneous fingering state and find that it spontaneously transforms into a layered state. By analysing our results in the light of the mean-field theory developed in Paper I, a clear picture of the sequence of events resulting in the staircase formation emerges. A collective instability of homogeneous fingering convection first excites a field of gravity waves, with a well-defined vertical wavelength. However, the waves saturate early through regular but localized breaking events, and are not directly responsible for the formation of the staircase. Meanwhile, slower-growing, horizontally invariant but vertically quasi-periodic γ-modes are also excited and grow according to the γ−instability mechanism. Our results suggest that the nonlinear interaction between these various mean-field modes of instability leads to the selection of one particular γ−mode as the staircase progenitor. Upon reaching a critical amplitude, this progenitor overturns into a fully-formed staircase. We conclude by extending the results of our simulations to real oceanic parameter values, and find that the progenitor γ−mode is expected to grow on a timescale of a few hours, and leads to the formation of a thermohaline staircase in about one day with an initial spacing of the order of one to two metres.