As said above while considering precepts, precepts have the same role in law as propositions in speculative sciences. In these latter, conclusions are virtually contained in the first principles; thus who completely knows the principles according to their whole power does not need the conclusions to be separately proposed. But because not all who know the principles are wholly able consider whatever is virtually contained in the principles, it is necessary for their sake that conclusions of science should should be drawn from their principles. But in practical things, in which precepts of law direct us, the end has the character of a principle, as said above. But love for God is the end to which love of neighbor is ordered. And so it it is fitting for us not only to be given a precept of the love of God, but also of love of neighbor, on account of the less competent, who do not easily consider that one of these precepts is contained in the other.
Thomas Aquinas, Summa Theologiae 2-2.44.2 (my translation).