Saturn's F ring is a narrow ring of icy particles, located 3,400 km beyond the outer edge of the main ring system. Enigmatically, the F ring is accompanied on either side by two small satellites, Prometheus and Pandora, which are called shepherd satellites. The inner regular satellites of giant planets are thought to form by the accretion of particles from an ancient massive ring and subsequent outward migration. However, the origin of a system consisting of a narrow ring and shepherd satellites remains poorly understood. Here we present N-body numerical simulations to show that a collision of two of the small satellites that are thought to accumulate near the main ring's outer edge can produce a system similar to the F ring and its shepherd satellites. We find that if the two rubble-pile satellites have denser cores, such an impact results in only partial disruption of the satellites and the formation of a narrow ring of particles between two remnant satellites. Our simulations suggest that the seemingly unusual F ring system is a natural outcome at the final stage of the formation process of the ring-satellite system of giant planets.