We present a numerical method for the solution of nonlinear geomechanical problems involving localized deformation along shear bands and fractures. We leverage the boundary element method to solve for the quasi-static elastic deformation of the medium while rigid-plastic constitutive relations govern the behavior of displacement discontinuity (DD) segments capturing localized deformations. A fully implicit scheme is developed using a hierarchical approximation of the boundary element matrix. Combined with an adequate block preconditioner, this allows to tackle large problems via the use of an iterative solver for the solution of the tangent system. Several two-dimensional examples of the initiation and growth of shear-bands and tensile fractures illustrate the capabilities and accuracy of this technique. The method does not exhibit any mesh dependency associated with localization provided that (i) the softening length-scale is resolved and (ii) the plane of localized deformations is discretized a priori using DD segments.