Answer
**Buddhism**, an ancient Indian philosophy, initially shaped his political and spiritual endeavors. The teachings of compassion, non-violence, and the pursuit of enlightenment aligned with his quest for justice and social harmony, influencing his early commitment to social activism and religious exploration. Buddhism provided a framework for understanding the interconnectedness of all beings and the importance of ethical conduct, impacting his subsequent political actions and religious beliefs.