"Therefore you are to be perfect, as your heavenly Father is perfect."
Startling as this is, the religious experts should not have been astonished, since it's completely consistent with what God said to Abram:
"I am God Almighty; Walk before Me, and be blameless."
(Genesis 17:1)
Since Abram's first encounter with God many years earlier, he has made a number of missteps. Nevertheless, God unveils here the plan for His eternal covenant. This is where Abram is given his new name, Abraham, and it's also where God first refers to Himself by a name: El Shaddai, translated in many versions as "God Almighty." I love that this is the first name God reveals for Himself. It's a huge "umbrella" term that speaks of the Lord's all-encompassing might, nurture, protection, and care, and of His unique power to bring growth and life.
The NASB places a comma in "Walk before Me, and be blameless." This is conventional English punctuation, separating two independent clauses that are linked by a conjunction, i.e. Walk before Me + and + be blameless. But although these are separate clauses grammatically, they are not two independent thoughts. When you look at them as a unit, you see the most amazing thing. This is the core message of the Bible: "Walk in unity with Me in My blamelessness, in My integrity, in My wholeness, in My perfection, in My holiness."
"Perfect" in Jesus' statement "be perfect" is the same word as "blameless" in God's "be blameless" to Abram. Upon closer inspection, this thought is woven into the Bible everywhere -- not usually in these exact words, but up and down and back and forth throughout scripture, anywhere we are told to revere God, to look to Him alone, to walk in integrity (or righteousness or humility or justice), to love God and others. We cannot do these things apart from His grace and power, but we also have to step in --"walk before Me" -- and keep going. He will not force us.
When Jesus called upon people to be perfect, He was revealing the sweet secret of God's ultimate plan: Himself. Without Christ's atoning death on our behalf, all we can do is strive, because everything we need in order to "walk before God and be blameless" (one unified thought) is in Him... it is Him.