The failure behavior of geological materials depends heavily on confining pressure and strain rate. Under a relatively low confining pressure, these materials tend to fail by brittle, localized fracture, but as the confining pressure increases, they show a growing propensity for ductile, diffuse failure accompanying plastic flow. Furthermore, the rate of deformation often exerts control on the brittleness. Here we develop a theoretical and computational modeling framework that encapsulates this variety of failure modes and their brittle-ductile transition. The framework couples a pressure-sensitive plasticity model with a phase-field approach to fracture which can simulate complex fracture propagation without tracking its geometry. We derive a phase-field formulation for fracture in elastic-plastic materials as a balance law of microforce, in a new way that honors the dissipative nature of the fracturing processes. For physically meaningful and numerically robust incorporation of plasticity into the phase-field model, we introduce several new ideas including the use of phase-field effective stress for plasticity, and the dilative/compactive split and rate-dependent storage of plastic work. We construct a particular class of the framework by employing a Drucker–Prager plasticity model with a compression cap, and demonstrate that the proposed framework can capture brittle fracture, ductile flow, and their transition due to confining pressure and strain rate.