In Galatians, God's Magna Carta of Christian Liberty, Paul emphasised justification by faith first (chapters 1-4), because it is foundational, and puts us in position, where we can receive and walk in His sanctifying Spirit, who empowers us to overcome sin in the flesh (chapters 5-6). First, God sent His Son to set us free from the Law by His death on the Cross, and then on that basis, He sent His Spirit into our hearts to set us free from sin (see Romans 6:14). Christ has set us free from the Law's dominion, curse and condemnation. Having been justified by faith, we are now under grace and are at peace with God on the basis of the perfect righteousness and work of Christ.
We have been set free from the Law, in order to enjoy a life of liberty under grace (v1,13). Therefore, we must not submit to a yoke of legalism - trying to get right with God on the basis of our works (v1-12), for while we remain under legalism, struggling in the flesh to fulfil God's Law, we cut ourselves off from the liberating Spirit of grace, and as a result sin will have dominion over us. We have been called by grace into a life of liberty from (1) the Law and (2) sin (the sin-nature in our flesh). He set us free from the Law, so that by His Spirit within us, we might live a life of freedom from sin. Therefore Paul says in v13 that we must not use our freedom from the Law as an excuse or basis to indulge our flesh, because that is just another form of bondage - slavery to sin. Christ did not come to give us freedom to sin, but freedom to not sin. God graciously set us free from the tyranny of the Law, so that we might be set free from self (the flesh), to serve others in love, and so fulfil God's law of love, through His Spirit of love within us. There are 2 ditches of bondage on either side of the road of freedom: legalism and license. Both involve bondage to different aspects of our fallen flesh.