A couple of years ago I read something by a professor named Michael Horton that helped to enlighten me on a certain psalm. I don't exactly remember where I read it, but this is the basic understanding.
Psalm 24 talks about someone ascending into God's realm. It says, "Who shall ascend the hill of the LORD?" The answer: "He who has clean hands and a pure heart. . . ."
I don't know about you, but if I read that I automatically will think, "GUILTY!" And, because I'm guilty, I'll never ascend to the hill of the LORD. So, it was a valiant (or not-so-valiant) effort, but there's no hope in myself to attain to God's glories.
Many of you might scan over this psalm, read that passage, and then get to verse 7 where it says, "Lift up your heads, O gates! And be lifted up, O ancient doors, that the King of glory may come in." Why does the psalmist move from "the generation of those who seek him" to the lifting up of the gates' heads?
Here's the logical flow: NO ONE has clean hands or pure hearts; so, there had to be another way to ascend God's hill. Who ascended? The King of glory. There's a picture of a triumphal entry into a city. According to James 2:1, Jesus is the Lord of glory; so, Jesus is the one entering the city gates with clean hands and a pure heart, and anyone who has placed their hope and trust in Jesus is following Him into the city of God.
So, who has clean hands and a pure heart? Jesus! And, in Him, we will grow in purity and love and be a generation that seeks His face.