An importance-sampling method is presented that allows the simulation of the history of a selected allele in a population of variable size. A sample path describing the number of copies of an allele that arose as a single mutant is generated by simulating backwards from the current frequency until the allele is lost. The mathematical expectation of a quantity or statistic is then estimated by taking averages over replicate simulations, weighting each replicate by the ratio of its probabilities under the Markov chains for the forward and backwards processes. This method was used to find the average age of a selected allele in an exponentially growing population. In terms of the effect on average allele age, selection in favour of an allele is not equivalent to exponential growth. To generate gene genealogies of a sample of copies of a selected allele, the neutral coalescent model is simulated for the subpopulation containing only the selected allele. From the resulting intra-allelic genealogy, it is possible to calculate the likelihood of the selection intensity as a function of the observed level of variability at marker loci closely linked to the selected allele. This method was used to estimate the intensity of selection affecting the delta 32 allele at the CCR5 locus in Europeans and a mutant at the MLH1 locus associated with colorectal cancer in the Finnish population.