As Siddhārtha mediated under the fig tree, he was tempted by the demons of Mara. It was then that he achieved Enlightenment.
He finally understood that suffering is caused when we are too attached to the things of this world:
When we have luxury, we are obsessed with the idea of having things.
When we practice asceticism, we are obsessed with the idea of not having things.
True peace is achieved by following the Middle Way, living a life of neither luxury nor asceticism, and having only what we need. If we are not obsessed by the material things of this world, then we are free to behave morally and properly.
The Four Noble Truths:
1. Suffering (dukkha) exists.
2. Suffering arises from attachment to worldly things.
3. Suffering can be ended by setting aside attachment to worldly things.
4. The way to end attachment to worldly things is neither indulgence nor asceticism, but the 'Middle Way' in between these two opposite extremes.