Why did castes become a part of Hindu society?

A. They ensured economic prosperity for all who performed proper roles.
B. They maintained law and order by reducing conflict.
C. They protected Indian culture from foreign influences.
D. They supported religious notions about spiritual purity.

D. They supported religious notions about spiritual purity.