Background: The Gram-negative bacterium Anaplasma phagocytophilum is an intracellular pathogen and an etiological agent of human and animal anaplasmosis. Its natural reservoir comprises free-ranging ungulates, including roe deer (Capreolus capreolus) and red deer (Cervus elaphus). These two species of deer also constitute the largest group of game animals in Poland. The aim of the study was to genotype and perform a phylogenetic analysis of A. phagocytophilum strains from roe deer and red deer. Methods: Samples were subjected to PCR amplification, sequencing, and phylogenetic analysis of strain-specific genetic markers (groEL, ankA). Results: Five haplotypes of the groEL gene from A. phagocytophilumand seven haplotypes of ankA were obtained. The phylogenetic analysis classified the groEL into ecotypes I and II. Sequences of the ankA gene were classified into clusters I, II, and III. Conclusions: Strains of A. phagocytophilum from red deer were in the same ecotype and cluster as strains isolated from humans. Strains of A. phagocytophilum from roe deer represented ecotypes (I, II) and clusters (II, III) that were different from those isolated from red deer, and these strains did not show similarity to bacteria from humans. However, roe deer can harbor nonspecific strains of A. phagocytophilum more characteristic to red deer. It appears that the genetic variants from red deer can be pathogenic to humans, but the significance of the variants from roe deer requires more study.