We have developed a way to represent Mohr-Coulomb failure within a mantle-convection fluid dynamics code. We use a viscous model of deformation with an orthotropic viscoplasticity (a different viscosity is used for pure shear to that used for simple shear) to define a prefered plane for slip to occur given the local stress field. The simple-shear viscosity and the deformation can then be iterated to ensure that the yield criterion is always satisfied. We again assume the Boussinesq approximation, neglecting any effect of dilatancy on the stress field. An additional criterion is required to ensure that deformation occurs along the plane aligned with maximum shear strain-rate rather than the perpendicular plane, which is formally equivalent in any symmetric formulation. We also allow for strain-weakening of the material. The material can remember both the accumulated failure history and the direction of failure. We have included this capacity in a Lagrangian-integration-point finite element code and show a number of examples of extension and compression of a crustal block with a Mohr-Coulomb failure criterion. The formulation itself is general and applies to 2- and 3-dimensional problems