We show how epidemics in which individuals鈥?infectious periods are not necessarily exponentially distributed may be naturally modelled as piecewise deterministic Markov processes. For the standard susceptible-infective-removed (SIR) model, we exhibit a family of martingales which may be used to derive the joint distribution of the number of survivors of the epidemic and the area under the trajectory of infectives. We also show how these results may be extended to a model in which the rate at which an infective generates infectious contacts may be an arbitrary function of the number of susceptible individuals present.