A fault made of two segments or asperities having different strengths and subject to a constant strain rate is considered. The fault is modelled by a discrete dynamical system made of two blocks coupled by a spring and pulled at constant velocity on a rough plane. We give a complete analytical solution for the evolution of the system. The long-term behaviour of the fault is studied by calculating the orbits of the system in the phase space. The dynamics of the system has four different modes and produces a variety of behaviours: the asperities may slip one at a time, originating a medium-size earthquake, or simultaneously, originating a large earthquake. In the latter case, the focus may be at one asperity or at the other. In some cases, the weaker asperity may slip twice, both before and after the failure of the stronger asperity. The time pattern of the seismic events generated by the fault is controlled by the stress distribution on the asperities and may include many different behaviours. We devise suitable correspondence rules allowing application of the discrete model to real fault systems. As an example, the model is applied to the 1964 great Alaska earthquake, which was originated by the failure of two asperities, and a possible evolution of this fault system is discussed.