I think this was the secret of those philosophers of old who could escape from being dominated by fortune and, despite suffering and poverty, could rival their gods in happiness. By constantly busying themselves with thoughts about the limits that nature had placed on them, they became thoroughly convinced that nothing was in their power except their own thoughts, which was enough to prevent them from being attracted to other things. They were so absolutely in control of their thoughts that this gave them some reason to think themselves richer, more powerful, freer and happier than any men who—however favoured by nature and fortune they may be—don’t have this philosophy and so never get such control over all their desires.
Descartes figured out that almost nothing is in our absolute power but our own thoughts. To the extent that our own thoughts are not in our power, we can not be free. It seems that freedom of thought is more basic even than freedom of action. There will always be constraints on action or behavior, but even a prisoner can have his / her own thoughts. Of course, behavior comes from thought as well, in the sense that we can have an idea to do something and then do it. It is hard to act freely unless one is thinking freely first.
I think most people don't have a very capacious idea of freedom. On the left people usually distrust freedom, thinking it is only for the rich and emphasizing all the constraints. Conservatives pretend to love freedom & responsibility but can't imagine it for their slaves, and can't even imagine any free act that isn't related to economics.