What is the difference between and phytopathogen and an endophyte?

Phytopathogens are bacteria or fungi, often with part of their life cycle in the soil, which cause harm to the plant. Diseases are caused by phytopathogens. Endophytes colonize an ecological niche similar to that of phytopathogens, which makes them suitable as bio-control agents