Religious leaders wanted to stone Him because He healed people on the Sabbath. Jesus told them that the Sabbath was made for man, and not man for the Sabbath. He understood the purpose and intent of the law. The religious leaders only knew the letter of the law. Those who follow only the letter of the law and ignore the spirit of the law fall into the trap of legalism.
Legalism ultimately produces defeat.
Such legalism brought condemnation from members of his own party and ultimately left a bad taste in the mouth of the general population. He was arguing the letter of the law, but ignoring the spirit of the law. Many Christians have done the same thing. Legalism always leads to defeat. That's why the Bible instructs us to live by the power of the Holy Spirit.