The Pharisees, very pleased that the Sadducees had been silenced by Jesus, now had their own challenge for him. "Which is the greatest commandment of the Law?" they asked him, to see how He would answer. Jesus responds very quickly, astutely not by using His own words but quoting from the Books of the Law which the Pharisees so revered. In his reply He quotes not one but two laws: a) You must love the Lord your God with all your heart, with all your soul. This is from Deuteronomy 6:5, and b) You must love your neighbour as yourself. This is from Leviticus 19:18.
From elsewhere in Matthew's gospel (e.g. Mt. 25) we know that not only are these two commandments similar, they are complementary and inseparable. In other words, it is not possible to love God and not love the neighbour and vice versa. So these two commandments are really only one. And, in Luke's treatment of the same context, the identity of the "neighbour" will be clearly shown. It cannot be confined to people near me or people of my own religious or ethnic group. "As often as you did it to the very least of my brothers and sisters¡Kyou did it to Me". There are no exceptions. None.
So Jesus is saying that as long as one is truly loving God and neighbour, loving God in the neighbour, the rest of the law will take care of itself. Put simply, no truly loving act can ever be sinful. Because, where there is love, there is God (cf. 1 Jn. 4).
Faith, hope and love abide but the greatest is love.