"fixing our eyes on Jesus, the pioneer and perfecter of faith. For the joy set before him he endured the cross, scorning its shame, and sat down at the right hand of the throne of God. Consider him who endured such opposition from sinners, so that you will not grow weary and lose heart. In your struggle against sin, you have not yet resisted to the point of shedding your blood." NIV translation
How do we stand firm in this battle between legalism and faith? Paul tells us to keep our eyes focused on Jesus as He faced the same battle when He walked this earth. We can remember that the opposition that He faced went so far as killing Him in the most shameful way.
"And have you completely forgotten this word of encouragement that addresses you as a father addresses his son? It says, 'My son, do not make light of the Lord's discipline, and do not lose heart when he rebukes you, because the Lord disciplines the one he loves, and he chastens everyone he accepts as his son.'" NIV translation
Paul quotes Solomon from Proverbs 3:11 & 12. The word discipline comes from the word disciple which refers to one that follows a teacher. We are reminded that, like any good father, God trains His children to follow His ways. He uses all things for this purpose including health problems, financial problems, relationship problems, etc. Whatever you are going through, have faith (trust) that your heavenly Father is in control and is allowing things to happen for your own good.
"Endure hardship as discipline; God is treating you as his children. For what children are not disciplined by their father? If you are not disciplined - and everyone undergoes discipline - then you are not legitimate, not true sons and daughters at all." NIV translation
We accept this discipline as a child and can be encouraged that our heavenly Father loves us enough to guide us. Paul even goes so far as to say that, if you are not disciplined by God, then you are not a child of God.
A big part of the problem with legalism is that it leads to people wanting to hand out the discipline in God's place. As Christians, it is not our job to beat people down with the word or to try to whip people into shape. We are not the parent and so we do not have the right. If you have children, how would you feel if a stranger walked up to you and started to discipline your child? You wouldn't like it and God does not like it either!