"One of the teachers of the law came and heard them debating. Noticing that Jesus had given them a good answer, he asked him, 'Of all the commandments, which is the most important?'" NIV translation
They were in the temple courtyard and a teacher of the law heard the debate between Jesus and the Sadducees about the resurrection. Based on that, this teacher of the law decided to ask Jesus about the commandments.
"'The most important one,' answered Jesus, 'is this: "Hear, O Israel: The Lord our God, the Lord is one. Love the Lord your God with all your heart and with all your soul and with all your mind and with all your strength." The second is this: "Love your neighbor as yourself." There is no commandment greater than these.'" NIV translation
The understanding of Jesus' answer is vital to our walk with Him. The Hebrew word that is used and is translated as "love" is hesed. It is tough to put the meaning in English but it basically means a "loyal love". This is more of an action word than a feeling and it is not based on our surroundings or events going on in our lives.
In the first case, we are called to worship God no matter how we feel or what is going on in our lives not just when things are going great. In the second case, we are to actively serve those around us even if they treat us badly. It is all based on the fact that God does not abandon us when we mess up or fall short of what we can be. Instead, He demonstrates a loyal love that is firm no matter how badly we act towards Him.
"'Well said, teacher,' the man replied. 'You are right in saying that god is one and there is no other but him. To love him with all your heart, with all your understanding and with all your strength, and to love your neighbor as yourself is more important than all burnt offerings and sacrifices.' When Jesus saw that he had answered wisely, he said to him, 'You are not far from the kingdom of God.' And from them on no one dared ask him any more questions." NIV translation
This teacher accepted and agreed with the words of Jesus. This prompted Jesus to say that he was close to understanding and entering the kingdom of heaven.
Hesed is one of the greatest things about God that we can share with people that have not accepted Jesus Christ. When they understand that He will show the loyal love to them, it can really help them. Many come to faith with a fear that they are going to stumble and say or do something that causes God to reject them. The understanding of God's hesed can wipe those fears away.