The statement asked in the question was told by Krishna to Jarasandha in the following excerpt of Sabha Parva of Mahabaratha
"Krishna said,--'O thou of mighty arms, there is a certain person of
the head of a (royal) line who upholdeth the dignity of his race At
his command have we come against thee. Thou hast brought, O king, many
of the Kshatriyas of the world as captives (to thy city.) Having
perpetrated that wicked wrong how dost thou regard thyself as
innocent? O best of monarchs, how can a king act wrongfully towards
other virtuous kings? But thou, O king, treating other kings with
cruelty, seekest to offer them as sacrifice unto the god Rudra! O son
of Vrihadratha, this sin committed by thee may touch even us, for as
we are virtuous in our practices, we are capable of protecting virtue.
The slaughter of human being as sacrifice unto the gods is never seen.
Why dost thou, therefore, seek to perform a sacrifice unto god Sankara
by slaughtering human beings? Thou art addressing persons belonging to
thy own order as animals (fit for sacrifice)! Fool as thou art, who
else, O Jarasandha, is capable of behaving in this way? One always
obtaineth the fruits of whatever acts one performeth under whatever
circumstances. Therefore, desirous as we are of helping all distressed
people, we have, for the prosperity of our race, come hither to slay
thee, the slaughterer of our relatives. Thou thinkest that there is no
man among the Kshatriyas (equal to thee). This, O king, is a great
error of judgment on thy part. What Kshatriya is there, O king, who
endued with greatness of soul and recollecting the dignity of his own
parentage, would not ascend to eternal heaven that hath not its like
anywhere, falling in open fight? Know O bull among men, that
Kshatriyas engage themselves in battle, as persons installed in
sacrifices, with heaven in view, and vanquish the whole world! Study
of the Vedas, great fame, ascetic penances, and death in battle, are
all acts that lead to heaven. The attainment of heaven by the three
other acts may be uncertain, but death in battle hath that for its
certain consequence. Death in battle is the sure cause of triumph like
Indra's. It is graced by numerous merits. It is for this reason that
he of a hundred sacrifices (Indra) hath become what he is, and by
vanquishing the Asuras he ruleth the universe. Hostility with whom
else than thee is so sure of leading to heaven, proud as thou art of
the excessive strength of thy vast Magadha host? Don't disregard
others, O king. Valour dwelleth in every man. O king of men, there are
many men whose valour may be equal or superior to thine. As long as
these are not known, so long only art thou noted for thy valour. Thy
prowess, O king, can be borne by us. It is, therefore, that I say so.
O king of Magadha, cast off thy superiority and pride in the presence
of those that are thy equals. Go not, O king, with thy children and
ministers and army, into the regions of Yama. Damvodhava, Kartavirya,
Uttara, and Vrihadratha, were kings that met with destruction, along
with all their forces, for having disregarded their superiors.
Desirous of liberating the captive monarchs from thee, know that we
are certainly not Brahmanas. I am Hrishesha otherwise called Sauri,
and these two heroes among men are the sons of Pandu. O king of
Magadha, we challenge thee. Fight standing before us. Either set free
all the monarchs, or go thou to the abode of Yama.