Antimicrobial peptides (AMPs) are small, usually cationic peptides, which permeabilize bacterial membranes. Understanding their mechanism of action might help design better antibiotics. Using an implicit membrane model, modified to include pores of different shapes, we show that four AMPs (alamethicin, melittin, a magainin analogue, MG-H2, and piscidin 1) bind more strongly to membrane pores, consistent with the idea that they stabilize them. The effective energy of alamethicin in cylindrical pores is similar to that in toroidal pores, whereas the effective energy of the other three peptides is lower in toroidal pores. Only alamethicin intercalates into the membrane core; MG-H2, melittin and piscidin are located exclusively at the hydrophobic/hydrophilic interface. In toroidal pores, the latter three peptides often bind at the edge of the pore, and are in an oblique orientation. The calculated binding energies of the peptides are correlated with their hemolytic activities. We hypothesize that one distinguishing feature of AMPs may be the fact that they are imperfectly amphipathic which allows them to bind more strongly to toroidal pores. An initial test on a melittin-based mutant seems to support this hypothesis.