One of the strangest verses in the Bible (my opinion) is found in 2 Chronicles 25:2. It is about king Amaziah. It says “he did what was right in the sight of the Lord, but not with a loyal heart” (NKJV).
Normally I can’t see into your heart. But God can, and He gives us a peak into the heart of Amaziah. He “did what was right” on two occasions. First in keeping with the Law of Moses Amaziah did not kill the sons of the people who had murdered his father (verses 3, 4). Second, Amaziah listened to God’s prophet and sent the mercenary soldiers back to North Israel (verses 5-10).
But Amaziah’s “heart was not loyal” to the Lord. Two examples are given. First he “bowed down before” the gods of Seir and “burned incense to them” (verse 14). Second he refused to listen when God’s prophet rebuked him for his sin (verses 15, 16).
People can do the will of God but not have a loyal heart. They may worship God because they know God desires that we worship Him (John 4:23); but then not worship Him according to truth (John 4:24). People may do what is right as long as it pleases them but when faced with their error their disloyal heart stops their ears to the truth of God’s word.
Is thy heart right with God, or are you like Amaziah?