Pauline scholars tend to agree that Paul's attitude concerning the Mosaic Law undergoes a modulation and development from Galatians to Romans.
Galatians appears to be Paul's "hot take" on the Law. Galatians is an extraordinarily emotional letter, a bit unhinged at times. The crisis was that some teachers had come to Paul's churches in Galatia and had begun preaching a gospel that demanded that Paul's Gentile converts be circumcised and begin observing the Torah (at least parts of it). For Paul, this was a repudiation of the work of the Messiah, whose work is embraced though faith.
Faith - Law - Faith
Now before faith came, we were held captive under the law, imprisoned until the coming faith would be revealed.
Formerly, when you did not know God, you were enslaved to those that by nature are not gods. But now that you have come to...
Wake Up To Breaking News!