The algebraic flux correction (AFC) paradigm is extended to finite element discretizations with a consistent mass matrix. It is shown how to render an implicit Galerkin scheme positivity-preserving and remove excessive artificial diffusion in regions where the solution is sufficiently smooth. To this end, the original discrete operators are modified in a mass-conserving fashion so as to enforce the algebraic constraints to be satisfied by the numerical solution. A node-oriented limiting strategy is employed to control the raw antidiffusive fluxes which consist of a convective part and a contribution of the consistent mass matrix. The former offsets the artificial diffusion due to `upwinding` of the spatial differential operator and lends itself to an upwind-biased flux limiting. The latter eliminates the error induced by mass lumping and calls for the use of a symmetric flux limiter. The concept of a target flux and a new definition of upper/lower bounds make it possible to combine the advantages of algebraic FCT and TVD schemes introduced previously by the author and his coworkers. Unlike other high-resolution schemes for unstructured meshes, the new algorithm reduces to a consistent (high-order) Galerkin scheme in smooth regions and is designed to provide an optimal treatment of both stationary and time-dependent problems. Its performance is illustrated by application to the linear advection equation for a number of 1D and 2D configurations.