A characterization for the solution of the Monge--Kantorovich mass transference problem