Bubonic plague has caused three deadly pandemics in human history: from the mid-sixth to mid-eighth century, from the mid-fourteenth to the mid-eighteenth century and from the end of the nineteenth until the mid-twentieth century. Between the second and the third pandemics, plague was causing sporadic outbreaks in only a few countries in the Middle East, including Egypt. Little is known about this historical phase of plague, even though it represents the temporal, geographical and phylogenetic transition between the second and third pandemics. Here we analysed in detail an outbreak of plague that took place in Cairo in 1801, and for which epidemiological data are uniquely available thanks to the presence of medical officers accompanying the Napoleonic expedition into Egypt at that time. We propose a new stochastic model describing how bubonic plague outbreaks unfold in both rat and human populations, and perform Bayesian inference under this model using a particle Markov chain Monte Carlo. Rat carcasses were estimated to be infectious for approximately 4 days after death, which is in good agreement with local observations on the survival of infectious rat fleas. The estimated transmission rate between rats implies a basic reproduction number R0 of approximately 3, causing the collapse of the rat population in approximately 100 days. Simultaneously, the force of infection exerted by each infected rat carcass onto the human population increases progressively by more than an order of magnitude. We also considered human-to-human transmission via pneumonic plague or human specific vectors, but found this route to account for only a small fraction of cases and to be significantly below the threshold required to sustain an outbreak.