We present numerical simulations of laminar and turbulent channel flow of an elastoviscoplastic fluid. The non-Newtonian flow is simulated by solving the full incompressible Navier-Stokes equations coupled with the evolution equation for the elastoviscoplastic stress tensor. The laminar simulations are carried out for a wide range of Reynolds numbers, Bingham numbers and ratios of the fluid and total viscosity, while the turbulent flow simulations are performed at a fixed bulk Reynolds number equal to 2800 and weak elasticity. We show that in the laminar flow regime the friction factor increases monotonically with the Bingham number (yield stress) and decreases with the viscosity ratio, while in the turbulent regime the the friction factor is almost independent of the viscosity ratio and decreases with the Bingham number, until the flow eventually returns to a fully laminar condition for large enough yield stresses. Three main regimes are found in the turbulent case, depending on the Bingham number: for low values, the friction Reynolds number and the turbulent flow statistics only slightly differ from those of a Newtonian fluid; for intermediate values of the Bingham number, the fluctuations increase and the inertial equilibrium range is lost. Finally, for higher values the flow completely laminarises. These different behaviors are associated with a progressive increases of the volume where the fluid is not yielded, growing from the centerline towards the walls as the Bingham number increases. The unyielded region interacts with the near-wall structures, forming preferentially above the high speed streaks. In particular, the near-wall streaks and the associated quasi-streamwise vortices are strongly enhanced in an highly elastoviscoplastic fluid and the flow becomes more correlated in the streamwise direction.